Read tool: offset parameter fails type validation when passed as string
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:
- Accept string-typed numbers and coerce them to integers (lenient validation), or
- 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.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗