AI_InvalidToolInputError: Invalid input for tool read. Path: limit #924

Closed
opened 2026-02-16 17:28:47 -05:00 by yindo · 5 comments
Owner

Originally created by @esafak on GitHub (Jul 25, 2025).

Originally assigned to: @thdxr on GitHub.

AI_InvalidToolInputError: Invalid input for tool read: Type validation failed: Value:
{"filePath":"/Users/emre/code/langserver/tests/tprojectsetup.nim","offset":"130","limit":
"80"}.
Error message: [
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [
      "offset"
    ],
    "message": "Expected number, received string"
  },
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [
      "limit"
    ],
    "message": "Expected number, received string"
  }
]

This is on OpenRouter Qwen3 Coder, 0.3.71

Originally created by @esafak on GitHub (Jul 25, 2025). Originally assigned to: @thdxr on GitHub. ``` AI_InvalidToolInputError: Invalid input for tool read: Type validation failed: Value: {"filePath":"/Users/emre/code/langserver/tests/tprojectsetup.nim","offset":"130","limit": "80"}. Error message: [ { "code": "invalid_type", "expected": "number", "received": "string", "path": [ "offset" ], "message": "Expected number, received string" }, { "code": "invalid_type", "expected": "number", "received": "string", "path": [ "limit" ], "message": "Expected number, received string" } ] ``` This is on OpenRouter Qwen3 Coder, 0.3.71
yindo added the model-problem label 2026-02-16 17:28:47 -05:00
yindo closed this issue 2026-02-16 17:28:47 -05:00
Author
Owner

@skpulipaka26 commented on GitHub (Jul 25, 2025):

I have the same issue.

Model: Qwen/Qwen3-Coder-480B-A35B-Instruct

AI_InvalidToolInputError: Invalid input for tool read: Type validation failed: Value:
{"filePath":"/foo.go","offset":"490"}.
Error message: [
  {
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [
      "offset"
    ],
    "message": "Expected number, received string"
  }
]
@skpulipaka26 commented on GitHub (Jul 25, 2025): I have the same issue. Model: `Qwen/Qwen3-Coder-480B-A35B-Instruct` ``` AI_InvalidToolInputError: Invalid input for tool read: Type validation failed: Value: {"filePath":"/foo.go","offset":"490"}. Error message: [ { "code": "invalid_type", "expected": "number", "received": "string", "path": [ "offset" ], "message": "Expected number, received string" } ] ```
Author
Owner

@aeramu commented on GitHub (Jul 25, 2025):

I have same issue with with Qwen3 Coder. At first it's working but after some progress, he does this a lot. After he does this, in that particular session, he will always does this. Need to create new session or change model halfway through. I don't know if it's Qwen problem for not using the tools properly or the tool should expect both integer and string because of the nature of unpredictability of model

@aeramu commented on GitHub (Jul 25, 2025): I have same issue with with Qwen3 Coder. At first it's working but after some progress, he does this a lot. After he does this, in that particular session, he will always does this. Need to create new session or change model halfway through. I don't know if it's Qwen problem for not using the tools properly or the tool should expect both integer and string because of the nature of unpredictability of model
Author
Owner

@ryzen3100 commented on GitHub (Jul 27, 2025):

Same issue here via OpenRouter.

@ryzen3100 commented on GitHub (Jul 27, 2025): Same issue here via OpenRouter.
Author
Owner

@alexispurslane commented on GitHub (Jul 28, 2025):

I also ran into very similar issues using qwen 3 coder via open router.

@alexispurslane commented on GitHub (Jul 28, 2025): I also ran into very similar issues using qwen 3 coder via open router.
Author
Owner

@thdxr commented on GitHub (Aug 12, 2025):

closing this old issue. openrouter has some low quality providers that don't follow tool schemas properly. suggest going directly to qwen or another provider instead of through openrouter for better reliability. if you're still hitting tool validation errors with a direct provider, open a new issue

@thdxr commented on GitHub (Aug 12, 2025): closing this old issue. openrouter has some low quality providers that don't follow tool schemas properly. suggest going directly to qwen or another provider instead of through openrouter for better reliability. if you're still hitting tool validation errors with a direct provider, open a new issue
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#924