Fetch tool consistently receives wrong input #965

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

Originally created by @David-Kunz on GitHub (Jul 29, 2025).

Originally assigned to: @thdxr on GitHub.

Hi,

I consistently get the following tool error when trying to use the Fetch tool:

AI_InvalidToolInputError: Invalid input for tool webfetch: Type validation failed: Value: {"format":"json","url":"<someURL>"}.
Error message: [
  {
    "received": "json",
    "code": "invalid_enum_value",
    "options": [
      "text",
      "markdown",
      "html"
    ],
    "path": [
      "format"
    ],
    "message": "Invalid enum value. Expected 'text' | 'markdown' | 'html', received 'json'"
  }
]

Note: The zod schema only accepts text, markdown or html, but the LLM tries to use it with json. I'm not sure why. Model is GPT-4.1.

Originally created by @David-Kunz on GitHub (Jul 29, 2025). Originally assigned to: @thdxr on GitHub. Hi, I consistently get the following tool error when trying to use the `Fetch` tool: ``` AI_InvalidToolInputError: Invalid input for tool webfetch: Type validation failed: Value: {"format":"json","url":"<someURL>"}. Error message: [ { "received": "json", "code": "invalid_enum_value", "options": [ "text", "markdown", "html" ], "path": [ "format" ], "message": "Invalid enum value. Expected 'text' | 'markdown' | 'html', received 'json'" } ] ``` Note: The `zod` schema [only accepts `text`, `markdown` or `html`](https://github.com/sst/opencode/blob/c165360e17d54e8c1f428dafbc700b8eae5dc3cf/packages/opencode/src/tool/webfetch.ts#L14), but the LLM tries to use it with `json`. I'm not sure why. Model is GPT-4.1.
yindo closed this issue 2026-02-16 17:28:56 -05:00
Author
Owner

@thdxr commented on GitHub (Jul 29, 2025):

i updated the prompt for gpt models just now lmk if it's better

@thdxr commented on GitHub (Jul 29, 2025): i updated the prompt for gpt models just now lmk if it's better
Author
Owner

@David-Kunz commented on GitHub (Jul 30, 2025):

Hi @thdxr , thanks a lot for looking into it. With opencode 0.3.84 the issue remains, unfortunately.

@David-Kunz commented on GitHub (Jul 30, 2025): Hi @thdxr , thanks a lot for looking into it. With `opencode 0.3.84` the issue remains, unfortunately.
Author
Owner

@Overload119 commented on GitHub (Aug 11, 2025):

I get this a lot with the GroqCloud OSS model.

@Overload119 commented on GitHub (Aug 11, 2025): I get this a lot with the GroqCloud OSS model.
Author
Owner

@rekram1-node commented on GitHub (Dec 27, 2025):

[automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

@rekram1-node commented on GitHub (Dec 27, 2025): [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#965