Github copilot "Failed to send message: 400" #293

Closed
opened 2026-02-16 17:26:05 -05:00 by yindo · 11 comments
Owner

Originally created by @sudo-tee on GitHub (Jun 26, 2025).

Originally assigned to: @thdxr on GitHub.

When trying to send a request to Github copilot (any model) I get this error

Failed to send message: 400

This is the config I have:

{
  "$schema": "https://opencode.ai/config.json",
  "theme": "opencode",
  "model": "github-copilot/gpt-4.1",
  "autoshare": false,
  "autoupdate": true
}

This is the logs I have:

opencode --print-logs
INFO  2025-06-26T10:33:59 +40ms service=default version=0.1.140 args=--print-logs opencode
INFO  2025-06-26T10:33:59 +0ms service=app cwd=/home/francis/dots creating
INFO  2025-06-26T10:33:59 +3ms service=app git=/home/francis/dots git
INFO  2025-06-26T10:33:59 +2ms service=app name=provider registering service
INFO  2025-06-26T10:33:59 +9ms service=app name=config registering service
INFO  2025-06-26T10:33:59 +7ms service=config $schema=https://opencode.ai/config.json theme=opencode autoshare=false autoupdate=true model=github-copilot/gpt-4.1 loaded
INFO  2025-06-26T10:33:59 +2ms service=models.dev refreshing
INFO  2025-06-26T10:33:59 +0ms service=provider init
INFO  2025-06-26T10:33:59 +3ms service=provider providerID=github-copilot found
INFO  2025-06-26T10:33:59 +0ms service=app name=share registering service
INFO  2025-06-26T10:33:59 +0ms service=bus type=storage.write subscribing
INFO  2025-06-26T10:33:59 +0ms service=app name=bus registering service
INFO  2025-06-26T10:33:59 +202ms service=server method=POST path=/config_get request
INFO  2025-06-26T10:33:59 +0ms service=server duration=0 response
INFO  2025-06-26T10:33:59 +4ms service=server method=GET path=/event request
INFO  2025-06-26T10:33:59 +1ms service=server event connected
INFO  2025-06-26T10:33:59 +2ms service=bus type=* subscribing
INFO  2025-06-26T10:33:59 +1ms service=server duration=3 response
INFO  2025-06-26T10:33:59 +13ms service=server method=POST path=/provider_list request
                                                                                      INFO  2025-06-26T10:33:59 +2ms service=server duration=1 response
                                                                                                                                                       INFO  2025-06-26T10:34:05 +2702ms service=bus type=* unsubscribing
INFO  2025-06-26T10:34:05 +0ms service=server event disconnected
INFO  2025-06-26T10:34:05 +1ms service=app name=session shutdown

Whe I run it with opencode run

opencode run "hello"

█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
▀▀▀▀ █▀▀▀ ▀▀▀ ▀  ▀ ▀▀▀ ▀▀▀▀ ▀▀▀  ▀▀▀

>  hello

@  github-copilot/gpt-4.1

Error: Unexpected error, check log file at /home/francis/.local/share/opencode/log/2025-06-26T103642.log for more details

This is the logfile content:

 cat /home/francis/.local/share/opencode/log/2025-06-26T103642.log
INFO  2025-06-26T10:36:42 +62ms service=default version=0.1.140 args=run,hello opencode
INFO  2025-06-26T10:36:42 +3ms service=app cwd=/home/francis/dots creating
INFO  2025-06-26T10:36:42 +1ms service=app git=/home/francis/dots git
INFO  2025-06-26T10:36:42 +1ms service=app name=share registering service
INFO  2025-06-26T10:36:42 +0ms service=bus type=storage.write subscribing
INFO  2025-06-26T10:36:42 +0ms service=app name=bus registering service
INFO  2025-06-26T10:36:42 +0ms service=session id=ses_854305924ffeQBgUCJmma6Z15p version=0.1.140 title=New Session - 2025-06-26T10:36:42.075Z time=[object Object] created
INFO  2025-06-26T10:36:42 +0ms service=app name=session registering service
INFO  2025-06-26T10:36:42 +0ms service=app name=storage registering service
INFO  2025-06-26T10:36:42 +1ms service=storage path=/home/francis/.local/share/opencode/project/home-francis-dots/storage init
INFO  2025-06-26T10:36:42 +0ms service=bus type=storage.write publishing
INFO  2025-06-26T10:36:42 +0ms service=app name=config registering service
INFO  2025-06-26T10:36:42 +2ms service=config $schema=https://opencode.ai/config.json theme=opencode autoshare=false autoupdate=true model=github-copilot/gpt-4.1 loaded
INFO  2025-06-26T10:36:42 +0ms service=bus type=session.updated publishing
INFO  2025-06-26T10:36:42 +0ms service=bus type=message.part.updated subscribing
INFO  2025-06-26T10:36:42 +1ms service=session session=ses_854305924ffeQBgUCJmma6Z15p chatting
INFO  2025-06-26T10:36:42 +1ms service=app name=provider registering service
INFO  2025-06-26T10:36:42 +1ms service=models.dev refreshing
INFO  2025-06-26T10:36:42 +1ms service=provider init
INFO  2025-06-26T10:36:42 +2ms service=provider providerID=github-copilot found
INFO  2025-06-26T10:36:42 +0ms service=provider providerID=github-copilot modelID=gpt-4.1 getModel
INFO  2025-06-26T10:36:42 +1ms service=provider status=started providerID=github-copilot getSDK
INFO  2025-06-26T10:36:42 +0ms service=provider status=completed duration=0 providerID=github-copilot getSDK
ERROR 2025-06-26T10:36:42 +4ms service=default providerID=github-copilot name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/home/francis/.cache/opencode/node_modules/@ai-sdk/openai-compatible' from '/$bunfs/root/opencode' fatal

Thanks a lot for your help

Originally created by @sudo-tee on GitHub (Jun 26, 2025). Originally assigned to: @thdxr on GitHub. When trying to send a request to Github copilot (any model) I get this error `Failed to send message: 400` This is the config I have: ``` { "$schema": "https://opencode.ai/config.json", "theme": "opencode", "model": "github-copilot/gpt-4.1", "autoshare": false, "autoupdate": true } ``` This is the logs I have: ``` opencode --print-logs INFO 2025-06-26T10:33:59 +40ms service=default version=0.1.140 args=--print-logs opencode INFO 2025-06-26T10:33:59 +0ms service=app cwd=/home/francis/dots creating INFO 2025-06-26T10:33:59 +3ms service=app git=/home/francis/dots git INFO 2025-06-26T10:33:59 +2ms service=app name=provider registering service INFO 2025-06-26T10:33:59 +9ms service=app name=config registering service INFO 2025-06-26T10:33:59 +7ms service=config $schema=https://opencode.ai/config.json theme=opencode autoshare=false autoupdate=true model=github-copilot/gpt-4.1 loaded INFO 2025-06-26T10:33:59 +2ms service=models.dev refreshing INFO 2025-06-26T10:33:59 +0ms service=provider init INFO 2025-06-26T10:33:59 +3ms service=provider providerID=github-copilot found INFO 2025-06-26T10:33:59 +0ms service=app name=share registering service INFO 2025-06-26T10:33:59 +0ms service=bus type=storage.write subscribing INFO 2025-06-26T10:33:59 +0ms service=app name=bus registering service INFO 2025-06-26T10:33:59 +202ms service=server method=POST path=/config_get request INFO 2025-06-26T10:33:59 +0ms service=server duration=0 response INFO 2025-06-26T10:33:59 +4ms service=server method=GET path=/event request INFO 2025-06-26T10:33:59 +1ms service=server event connected INFO 2025-06-26T10:33:59 +2ms service=bus type=* subscribing INFO 2025-06-26T10:33:59 +1ms service=server duration=3 response INFO 2025-06-26T10:33:59 +13ms service=server method=POST path=/provider_list request INFO 2025-06-26T10:33:59 +2ms service=server duration=1 response INFO 2025-06-26T10:34:05 +2702ms service=bus type=* unsubscribing INFO 2025-06-26T10:34:05 +0ms service=server event disconnected INFO 2025-06-26T10:34:05 +1ms service=app name=session shutdown ``` Whe I run it with `opencode run` ``` opencode run "hello" █▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀ █░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀ ▀▀▀▀ █▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ▀▀▀ > hello @ github-copilot/gpt-4.1 Error: Unexpected error, check log file at /home/francis/.local/share/opencode/log/2025-06-26T103642.log for more details ``` This is the logfile content: ``` cat /home/francis/.local/share/opencode/log/2025-06-26T103642.log INFO 2025-06-26T10:36:42 +62ms service=default version=0.1.140 args=run,hello opencode INFO 2025-06-26T10:36:42 +3ms service=app cwd=/home/francis/dots creating INFO 2025-06-26T10:36:42 +1ms service=app git=/home/francis/dots git INFO 2025-06-26T10:36:42 +1ms service=app name=share registering service INFO 2025-06-26T10:36:42 +0ms service=bus type=storage.write subscribing INFO 2025-06-26T10:36:42 +0ms service=app name=bus registering service INFO 2025-06-26T10:36:42 +0ms service=session id=ses_854305924ffeQBgUCJmma6Z15p version=0.1.140 title=New Session - 2025-06-26T10:36:42.075Z time=[object Object] created INFO 2025-06-26T10:36:42 +0ms service=app name=session registering service INFO 2025-06-26T10:36:42 +0ms service=app name=storage registering service INFO 2025-06-26T10:36:42 +1ms service=storage path=/home/francis/.local/share/opencode/project/home-francis-dots/storage init INFO 2025-06-26T10:36:42 +0ms service=bus type=storage.write publishing INFO 2025-06-26T10:36:42 +0ms service=app name=config registering service INFO 2025-06-26T10:36:42 +2ms service=config $schema=https://opencode.ai/config.json theme=opencode autoshare=false autoupdate=true model=github-copilot/gpt-4.1 loaded INFO 2025-06-26T10:36:42 +0ms service=bus type=session.updated publishing INFO 2025-06-26T10:36:42 +0ms service=bus type=message.part.updated subscribing INFO 2025-06-26T10:36:42 +1ms service=session session=ses_854305924ffeQBgUCJmma6Z15p chatting INFO 2025-06-26T10:36:42 +1ms service=app name=provider registering service INFO 2025-06-26T10:36:42 +1ms service=models.dev refreshing INFO 2025-06-26T10:36:42 +1ms service=provider init INFO 2025-06-26T10:36:42 +2ms service=provider providerID=github-copilot found INFO 2025-06-26T10:36:42 +0ms service=provider providerID=github-copilot modelID=gpt-4.1 getModel INFO 2025-06-26T10:36:42 +1ms service=provider status=started providerID=github-copilot getSDK INFO 2025-06-26T10:36:42 +0ms service=provider status=completed duration=0 providerID=github-copilot getSDK ERROR 2025-06-26T10:36:42 +4ms service=default providerID=github-copilot name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/home/francis/.cache/opencode/node_modules/@ai-sdk/openai-compatible' from '/$bunfs/root/opencode' fatal ``` Thanks a lot for your help
yindo closed this issue 2026-02-16 17:26:05 -05:00
Author
Owner

@sudo-tee commented on GitHub (Jun 26, 2025):

The folder /home/francis/.cache/opencode/ doe not contains any node_modules folder.

I ran a pnpm install in this folder and it worked after that.

@sudo-tee commented on GitHub (Jun 26, 2025): The folder `/home/francis/.cache/opencode/` doe not contains any node_modules folder. I ran a pnpm install in this folder and it worked after that.
Author
Owner

@thdxr commented on GitHub (Jun 26, 2025):

did it contain a package.json?

@thdxr commented on GitHub (Jun 26, 2025): did it contain a package.json?
Author
Owner

@sudo-tee commented on GitHub (Jun 26, 2025):

Yes this is why a pnpm install fixed the issue temporarly

@sudo-tee commented on GitHub (Jun 26, 2025): Yes this is why a pnpm install fixed the issue temporarly
Author
Owner

@dabing1022 commented on GitHub (Jul 6, 2025):

It should be fixed instead of manually running pnpm install.

@dabing1022 commented on GitHub (Jul 6, 2025): It should be fixed instead of manually running pnpm install.
Author
Owner

@adrian-martinez-dev commented on GitHub (Jul 11, 2025):

Updated to 0.2.30 version with "opencode upgrade" and I'm getting the same error

ERROR 2025-07-11T22:49:15 +4ms service=default providerID=github-copilot name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/home/adrian/.cache/opencode/node_modules/@ai-sdk/openai-compatible' from '/$bunfs/root/opencode' fatal
Error: Unexpected error, check log file at for more details

@adrian-martinez-dev commented on GitHub (Jul 11, 2025): Updated to 0.2.30 version with "opencode upgrade" and I'm getting the same error **ERROR 2025-07-11T22:49:15 +4ms service=default providerID=github-copilot name=ProviderInitError message=ProviderInitError cause=ResolveMessage: Cannot find module '/home/adrian/.cache/opencode/node_modules/@ai-sdk/openai-compatible' from '/$bunfs/root/opencode' fatal Error: Unexpected error, check log file at for more details**
Author
Owner

@iwinux commented on GitHub (Jul 13, 2025):

It seems to be related to https://github.com/sst/opencode/issues/863.

From network monitor I can see it hangs on request of registry.npmjs.org for 300s before making the real requests to LLM provider.

@iwinux commented on GitHub (Jul 13, 2025): It seems to be related to https://github.com/sst/opencode/issues/863. From network monitor I can see it hangs on request of `registry.npmjs.org` for 300s before making the real requests to LLM provider.
Author
Owner

@nipuna-perera commented on GitHub (Jul 14, 2025):

From network monitor I can see it hangs on request of registry.npmjs.org

This is a problem for people behind Enterprise firewalls. For example, we use artifactory as a package manager and our we have to pull node modules from artifactory.

Can opencode use the ~/.npmrc instead of hardcoding the registry? Then my local setup will work. Mason in neovim works fine with my current setup.

Yes this is why a pnpm install fixed the issue temporarly

My ~/.cache/opencode/package.json is empty {} so, doing pnpm or npm install is a noop.

@nipuna-perera commented on GitHub (Jul 14, 2025): > From network monitor I can see it hangs on request of registry.npmjs.org This is a problem for people behind Enterprise firewalls. For example, we use artifactory as a package manager and our we have to pull node modules from artifactory. Can opencode use the `~/.npmrc` instead of hardcoding the registry? Then my local setup will work. Mason in neovim works fine with my current setup. > Yes this is why a pnpm install fixed the issue temporarly My `~/.cache/opencode/package.json` is empty `{}` so, doing `pnpm` or `npm` install is a noop.
Author
Owner

@sudo-tee commented on GitHub (Jul 14, 2025):

We also have artifactory at work and . The hard-coded registry is giving me issues as well as it returns a 403.. instead of hanging.

@sudo-tee commented on GitHub (Jul 14, 2025): We also have artifactory at work and . The hard-coded registry is giving me issues as well as it returns a 403.. instead of hanging.
Author
Owner

@iwinux commented on GitHub (Jul 14, 2025):

Would be great if OpenCode offers an offline installer - no need to contact NPM registry at all.

@iwinux commented on GitHub (Jul 14, 2025): Would be great if OpenCode offers an offline installer - no need to contact NPM registry at all.
Author
Owner

@nipuna-perera commented on GitHub (Jul 15, 2025):

I am working a PR to support local .npmrc. However, I am running into issues with the project. I'll reach out on Discord.

@nipuna-perera commented on GitHub (Jul 15, 2025): I am working a PR to support local `.npmrc`. However, I am running into issues with the project. I'll reach out on Discord.
Author
Owner

@nipuna-perera commented on GitHub (Jul 16, 2025):

I just got a chance to test my fix on my actual work laptop and it worked well on my system :) 0.3.16 has the fix.

@nipuna-perera commented on GitHub (Jul 16, 2025): I just got a chance to test my fix on my actual work laptop and it worked well on my system :) `0.3.16` has the fix.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#293