Read tool: offset parameter fails type validation when passed as string

Resolved 💬 2 comments Opened Mar 2, 2026 by mapleberry Closed Mar 31, 2026

Summary

When the Read tool is invoked with an offset value as a string (e.g., "50") instead of a number (50), the tool throws a validation error rather than coercing the value.

Error

InputValidationError: Read failed due to the following issue:
The parameter `offset` type is expected as `number` but provided as `string`

Expected behavior

Either:

  1. Accept string-typed numbers and coerce them to integers (lenient validation), or
  2. Produce a clear error message pointing to the calling agent's generation as the source of the bug

Actual behavior

Hard validation failure with InputValidationError — aborts the tool call entirely with no fallback.

Context

Encountered during session auto-memory loading where the Read tool call was generated with offset as a string value. The JSON schema for the tool specifies type: "number" but Claude Code model outputs sometimes serialize numbers as strings in tool_use parameters.

Suggested fix

Add type coercion in the Read tool parameter validation layer: if offset is a valid numeric string, parse it to a number before schema validation.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗