Repository navigation
all requests fail with "AI_APICallError: Bad Request" #678
Copy link
Copy link
Closed
Description
session share: https://opencode.ai/s/Y7W3NNLv
auth list log
@zkdiff ➜ /workspaces/20250703-0 (main) $ opencode --print-logs auth list
INFO 2025-07-04T07:42:03 +69ms service=default version=0.1.189 args=--print-logs,auth,list opencode
┌ Credentials ~/.local/share/opencode/auth.json
INFO 2025-07-04T07:42:03 +5ms service=models.dev refreshing
│
└ 0 credentials
┌ Environment
│
● GitHub Copilot GITHUB_TOKEN
│
└ 1 environment variables
models log
@zkdiff ➜ /workspaces/20250703-0 (main) $ opencode --print-logs models
INFO 2025-07-04T07:41:05 +68ms service=default version=0.1.189 args=--print-logs,models opencode
INFO 2025-07-04T07:41:05 +1ms service=app cwd=/workspaces/20250703-0 creating
INFO 2025-07-04T07:41:05 +2ms service=app git=/workspaces/20250703-0 git
INFO 2025-07-04T07:41:05 +5ms service=app name=provider registering service
INFO 2025-07-04T07:41:05 +2ms service=app name=config registering service
INFO 2025-07-04T07:41:05 +2ms service=config loaded
INFO 2025-07-04T07:41:05 +1ms service=models.dev refreshing
INFO 2025-07-04T07:41:05 +0ms service=provider init
INFO 2025-07-04T07:41:05 +4ms service=provider providerID=github-copilot found
github-copilot/gemini-2.5-pro
github-copilot/claude-3.5-sonnet
github-copilot/o3-mini
github-copilot/gpt-4.1
github-copilot/claude-3.7-sonnet
github-copilot/claude-3.7-sonnet-thought
github-copilot/o4-mini
github-copilot/o1
github-copilot/gemini-2.0-flash-001
github-copilot/gpt-4o
github-copilot/claude-sonnet-4
session log
@zkdiff ➜ /workspaces/20250703-0 (main) $ opencode --print-logs run "/init"
INFO 2025-07-04T07:38:48 +74ms service=default version=0.1.189 args=--print-logs,run,/init opencode
INFO 2025-07-04T07:38:48 +0ms service=app cwd=/workspaces/20250703-0 creating
INFO 2025-07-04T07:38:48 +3ms service=app git=/workspaces/20250703-0 git
INFO 2025-07-04T07:38:48 +1ms service=bus type=storage.write subscribing
INFO 2025-07-04T07:38:48 +1ms service=app name=bus registering service
INFO 2025-07-04T07:38:48 +0ms service=format init
INFO 2025-07-04T07:38:48 +0ms service=bus type=file.edited subscribing
INFO 2025-07-04T07:38:48 +0ms service=config.hooks init
INFO 2025-07-04T07:38:48 +1ms service=bus type=file.edited subscribing
INFO 2025-07-04T07:38:48 +2ms service=bus type=session.idle subscribing
INFO 2025-07-04T07:38:48 +1ms service=app name=lsp registering service
INFO 2025-07-04T07:38:48 +0ms service=lsp initializing
INFO 2025-07-04T07:38:48 +1ms service=app name=file.watcher registering service
INFO 2025-07-04T07:38:48 +1ms service=session id=ses_82ba055aaffe7dDyjjQ26C9VU5 version=0.1.189 title=New Session - 2025-07-04T07:38:48.789Z time=[object Object] created
INFO 2025-07-04T07:38:48 +0ms service=app name=session registering service
INFO 2025-07-04T07:38:48 +1ms service=app name=storage registering service
INFO 2025-07-04T07:38:48 +0ms service=storage path=/home/codespace/.local/share/opencode/project/workspaces-20250703-0/storage init
INFO 2025-07-04T07:38:48 +4ms service=bus type=storage.write publishing
INFO 2025-07-04T07:38:48 +1ms service=app name=config registering service
INFO 2025-07-04T07:38:48 +3ms service=config loaded
INFO 2025-07-04T07:38:48 +0ms service=bus type=session.updated publishing
█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀
> /init
INFO 2025-07-04T07:38:48 +2ms service=app name=provider registering service
INFO 2025-07-04T07:38:48 +3ms service=models.dev refreshing
INFO 2025-07-04T07:38:48 +0ms service=provider init
INFO 2025-07-04T07:38:48 +3ms service=provider providerID=github-copilot found
@ github-copilot/claude-sonnet-4
INFO 2025-07-04T07:38:48 +2ms service=bus type=message.part.updated subscribing
INFO 2025-07-04T07:38:48 +2ms service=session session=ses_82ba055aaffe7dDyjjQ26C9VU5 chatting
INFO 2025-07-04T07:38:48 +1ms service=provider providerID=github-copilot modelID=claude-sonnet-4 getModel
INFO 2025-07-04T07:38:48 +0ms service=provider status=started providerID=github-copilot getSDK
INFO 2025-07-04T07:38:48 +44ms service=provider status=completed duration=44 providerID=github-copilot getSDK
INFO 2025-07-04T07:38:48 +4ms service=provider providerID=github-copilot modelID=claude-sonnet-4 found
INFO 2025-07-04T07:38:48 +4ms service=session sessionID=ses_82ba055aaffe7dDyjjQ26C9VU5 locking
INFO 2025-07-04T07:38:48 +13ms service=snapshot creating snapshot
INFO 2025-07-04T07:38:48 +24ms service=snapshot initialized
INFO 2025-07-04T07:38:48 +13ms service=snapshot added files
INFO 2025-07-04T07:38:48 +12ms service=snapshot commit
INFO 2025-07-04T07:38:48 +2ms service=bus type=storage.write publishing
INFO 2025-07-04T07:38:48 +1ms service=bus type=message.updated publishing
INFO 2025-07-04T07:38:48 +17ms service=bus type=storage.write publishing
INFO 2025-07-04T07:38:48 +1ms service=bus type=message.updated publishing
INFO 2025-07-04T07:38:48 +1ms service=app name=mcp registering service
INFO 2025-07-04T07:38:49 +54ms service=lsp initialized
ERROR 2025-07-04T07:38:49 +295ms service=session error=AI_APICallError: Bad Request callback error
INFO 2025-07-04T07:38:49 +1ms service=bus type=session.error publishing
INFO 2025-07-04T07:38:49 +1ms service=session session=ses_82ba055aaffe7dDyjjQ26C9VU5 type=error part
INFO 2025-07-04T07:38:49 +0ms service=session session=ses_82ba055aaffe7dDyjjQ26C9VU5 type=error unhandled
INFO 2025-07-04T07:38:49 +1ms service=bus type=storage.write publishing
INFO 2025-07-04T07:38:49 +0ms service=bus type=message.updated publishing
INFO 2025-07-04T07:38:49 +0ms service=session sessionID=ses_82ba055aaffe7dDyjjQ26C9VU5 unlocking
INFO 2025-07-04T07:38:49 +1ms service=bus type=session.idle publishing
INFO 2025-07-04T07:38:49 +0ms service=app name=lsp shutdown
INFO 2025-07-04T07:38:49 +0ms service=app name=file.watcher shutdown
INFO 2025-07-04T07:38:49 +0ms service=app name=session shutdown
INFO 2025-07-04T07:38:49 +0ms service=app name=mcp shutdown
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
zkdiff commentedon Jul 4, 2025
Same error occurs after explicitly authenticating
danriedl commentedon Jul 8, 2025
Probably related #739 . Try disabling all MCP Server, if configured.
zkdiff commentedon Jul 8, 2025
This is reproduced with a blank slate environment so while I can't say whether it is related to #739 or not, I would guess this particular defect is not related to MCP. I'll be able to dig into it in a couple of days if it is still an issue.
llucax commentedon Jul 10, 2025
Experiencing the same issue here after a first fresh install.
zkdiff commentedon Jul 10, 2025
@llucax are you use a GitHub codespace? If you aren't, do you have GITHUB_TOKEN set in your env?
llucax commentedon Jul 11, 2025
I'm not using a GitHub codepace, running locally. I configured the token manually via
auth login:I got the token from
~/.config/github-copilot/hosts.jsonas instructed in https://github.com/opencode-ai/opencode#using-github-copilot (I use both VSCode and copilot in nvim, not sure which one configured that token, but both work fine with copilot).tomwojcik commentedon Jul 25, 2025
I run into this issue a few times in a row. I run a new session with logs, it complained about pyright not running. I installed it (
npm install -g pyright) and so far so good, but I can't confirm it fixed the issue for good.rekram1-node commentedon Sep 25, 2025
is this still an issue?
coleleavitt commentedon Oct 3, 2025
yes I am getting it, gonna try to debug it
vapvarun commentedon Oct 3, 2025
I ran into the same error, and in my case it happened right after I pasted an image into the terminal for additional context. After that, the error kept appearing. Opening a fresh terminal window resolved the issue for me.
coleleavitt commentedon Oct 3, 2025
I figured out that the issue happens on grok 4 fast for me specifically due to tool limitations as I got over 200 tools for one local MCP server which is out of the scope of grok 4 fast. I'll test with my claude account but I think there needs to be an improvement in the error handling
jcubic commentedon Oct 3, 2025
I had the same problem. But I had
GITHUB_TOKENin my~/.bashrc. Removing the variable solved the issue.coleleavitt commentedon Oct 3, 2025
I think we come to the consensus that there needs to be more detailed/robust error handling
thdxr commentedon Mar 25, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
feat(skills): add rules-distill skill (rebased anomalyco#561) (anomal…
refactor(app): extract workspace/session list into dedicated component (