Reproducible AI_APICallError: Bad Request on a particular repo and prompt #1989

Closed
opened 2026-02-16 17:33:36 -05:00 by yindo · 7 comments
Owner

Originally created by @tbarron-xyz on GitHub (Oct 7, 2025).

Originally assigned to: @rekram1-node on GitHub.

I can't run certain types of tasks on the repo https://github.com/Jimver/cuda-toolkit with grok-code-fast-1. I keep getting AI_APICallError: Bad Request after a thinking. Haven't experienced this on any other repos with opencode + grok-code-fast-1. It does succeed on simple questions in plan mode like Give me a high-level overview of the project. And this prompt does not fail on other repos.

Example prompt in Plan mode: Find where use-local-cache is set to true by default. We need to set it to false by default
https://opencode.ai/s/EsZUFXii

imageImage

Doesn't work in build mode either

imageImage

Rephrasing of that prompt: Look in the code for where "use-local-cache" is set to true by default. We need to set it to false by default
https://opencode.ai/s/m7OpgcWZ

image

Image

Originally created by @tbarron-xyz on GitHub (Oct 7, 2025). Originally assigned to: @rekram1-node on GitHub. I can't run certain types of tasks on the repo https://github.com/Jimver/cuda-toolkit with grok-code-fast-1. I keep getting `AI_APICallError: Bad Request` after a thinking. Haven't experienced this on any other repos with opencode + grok-code-fast-1. It does succeed on simple questions in plan mode like `Give me a high-level overview of the project`. And this prompt does not fail on other repos. Example prompt in Plan mode: `Find where use-local-cache is set to true by default. We need to set it to false by default` https://opencode.ai/s/EsZUFXii <details><summary>image</summary><img width="377" height="706" alt="Image" src="https://github.com/user-attachments/assets/d44fad8c-5898-4316-88f3-9d629dd46df8" /></details> Doesn't work in build mode either <details><summary>image</summary><img width="413" height="756" alt="Image" src="https://github.com/user-attachments/assets/fd45e0cd-96c1-4c20-9eef-245159a174b1" /></details> Rephrasing of that prompt: `Look in the code for where "use-local-cache" is set to true by default. We need to set it to false by default` https://opencode.ai/s/m7OpgcWZ <details><summary>image</summary> <img width="896" height="758" alt="Image" src="https://github.com/user-attachments/assets/06cfd737-ed94-4704-88bf-298cc5fd455f" /></details>
yindo closed this issue 2026-02-16 17:33:36 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 7, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #678: all requests fail with "AI_APICallError: Bad Request" - Another issue where users experience consistent Bad Request errors with specific model and GitHub Copilot provider
  • #494: AI_APICallError: Bad Request Open Router - Similar Bad Request error occurring after search operations, though with OpenRouter provider instead of grok-code-fast-1

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Oct 7, 2025): This issue might be a duplicate of existing issues. Please check: - #678: all requests fail with "AI_APICallError: Bad Request" - Another issue where users experience consistent Bad Request errors with specific model and GitHub Copilot provider - #494: AI_APICallError: Bad Request Open Router - Similar Bad Request error occurring after search operations, though with OpenRouter provider instead of grok-code-fast-1 Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 7, 2025):

@tbarron-xyz do you have any mcp servers by chance? Just curious what could cause this.. Ill try to reproduce when I get a chance later today

@rekram1-node commented on GitHub (Oct 7, 2025): @tbarron-xyz do you have any mcp servers by chance? Just curious what could cause this.. Ill try to reproduce when I get a chance later today
Author
Owner

@tbarron-xyz commented on GitHub (Oct 7, 2025):

@rekram1-node No MCP servers, my ~/.config/opencode is an empty folder. Pretty much virgin opencode with grok-code-fast-1.

@tbarron-xyz commented on GitHub (Oct 7, 2025): @rekram1-node No MCP servers, my ~/.config/opencode is an empty folder. Pretty much virgin opencode with grok-code-fast-1.
Author
Owner

@OpeOginni commented on GitHub (Oct 7, 2025):

@tbarron-xyz what provider are you using?

@OpeOginni commented on GitHub (Oct 7, 2025): @tbarron-xyz what provider are you using?
Author
Owner

@tbarron-xyz commented on GitHub (Oct 7, 2025):

It's in the second and third screenshots - opencode zen.

@tbarron-xyz commented on GitHub (Oct 7, 2025): It's in the second and third screenshots - opencode zen.
Author
Owner

@OpeOginni commented on GitHub (Oct 7, 2025):

@tbarron-xyz I think I might have a solution, noticed that the model tries to get data from your massive files such as the dist and the .licenses folders, so try creating a local opencode.json and add the following there.

{
    "$schema": "https://opencode.ai/config.json",
    "watcher": {
      "ignore": [".devcontainer", ".vscode", "licenses", "dist"]
    }
  }

After doing this, I tested the commands you gave and they worked well on your repo.

Image Image
@OpeOginni commented on GitHub (Oct 7, 2025): @tbarron-xyz I think I might have a solution, noticed that the model tries to get data from your massive files such as the `dist` and the `.licenses` folders, so try creating a local `opencode.json` and add the following there. ```json { "$schema": "https://opencode.ai/config.json", "watcher": { "ignore": [".devcontainer", ".vscode", "licenses", "dist"] } } ``` After doing this, I tested the commands you gave and they worked well on your repo. <details> <summary>Image</summary> <img width="1413" height="821" alt="Image" src="https://github.com/user-attachments/assets/22b02f58-3cd9-4482-8a0f-58ef7b22db4b" /> <details>
Author
Owner

@rekram1-node commented on GitHub (Oct 7, 2025):

damn what a g thx @OpeOginni

@rekram1-node commented on GitHub (Oct 7, 2025): damn what a g thx @OpeOginni
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1989