Skip to content

[BUG] opencode agent create throws error when using OpenAI as provider #20820

@RisaKirisu

Description

@RisaKirisu

Description

Previous issues mentioned similar issue but was never fixed:
#7995
#7322

Terminal output:

risa@RisaK-Desktop:~$ opencode agent create --log-level=DEBUG --print-logs --pure --model openai/gpt-5.4
INFO  2026-04-03T05:54:49 +373ms service=default version=1.3.13 args=["agent","create","--log-level=DEBUG","--print-logs","--pure","--model","openai/gpt-5.4"] opencode
INFO  2026-04-03T05:54:49 +1ms service=default directory=/home/risa creating instance
INFO  2026-04-03T05:54:49 +5ms service=project directory=/home/risa fromDirectory
INFO  2026-04-03T05:54:49 +12ms service=db path=/home/risa/.local/share/opencode/opencode.db opening database
INFO  2026-04-03T05:54:49 +2ms service=db count=10 mode=bundled applying migrations

┌  Create agent
│
◇  Description
│  General question answering, calculation, and conversational agent. Approximately 70/30 on technical vs general
│
INFO  2026-04-03T05:54:55 +5461ms service=config path=/home/risa/.config/opencode/config.json loading
INFO  2026-04-03T05:54:55 +18ms service=config path=/home/risa/.config/opencode/opencode.json loading
INFO  2026-04-03T05:54:55 +12ms service=config path=/home/risa/.config/opencode/opencode.jsonc loading
DEBUG 2026-04-03T05:54:55 +14ms service=config loading config from /home/risa/.opencode/opencode.jsonc
INFO  2026-04-03T05:54:55 +0ms service=config path=/home/risa/.opencode/opencode.jsonc loading
DEBUG 2026-04-03T05:54:55 +1ms service=config loading config from /home/risa/.opencode/opencode.json
INFO  2026-04-03T05:54:55 +0ms service=config path=/home/risa/.opencode/opencode.json loading
INFO  2026-04-03T05:54:55 +8ms service=provider status=started state
◒  Generating agent configurationINFO  2026-04-03T05:54:55 +38ms service=provider init
INFO  2026-04-03T05:54:55 +13ms service=plugin name=CodexAuthPlugin loading internal plugin
INFO  2026-04-03T05:54:55 +0ms service=plugin name=CopilotAuthPlugin loading internal plugin
INFO  2026-04-03T05:54:55 +1ms service=plugin name=gitlabAuthPlugin loading internal plugin
INFO  2026-04-03T05:54:55 +0ms service=plugin name=PoeAuthPlugin loading internal plugin
INFO  2026-04-03T05:54:55 +0ms service=bus type=* subscribing
INFO  2026-04-03T05:54:55 +16ms service=provider providerID=openrouter found
INFO  2026-04-03T05:54:55 +0ms service=provider providerID=openai found
INFO  2026-04-03T05:54:55 +0ms service=provider providerID=opencode found
INFO  2026-04-03T05:54:55 +0ms service=provider status=completed duration=68 state
INFO  2026-04-03T05:54:55 +1ms service=provider status=started providerID=openai getSDK
INFO  2026-04-03T05:54:55 +1ms service=provider providerID=openai pkg=@ai-sdk/openai using bundled provider
INFO  2026-04-03T05:54:55 +0ms service=provider status=completed duration=1 providerID=openai getSDK
◐  Generating agent configurationINFO  2026-04-03T05:54:55 +11ms service=skill count=0 init
■  LLM failed to generate agent: Bad Request
ERROR 2026-04-03T05:54:55 +321ms service=default name=UICancelledError message=UICancelledError stack=UICancelledError: UICancelledError
    at <anonymous> (/$bunfs/root/src/index.js:451509:17)
    at processTicksAndRejections (native:7:39) fatal



risa@RisaK-Desktop:~$ opencode -v
1.3.13



risa@RisaK-Desktop:~$ cat  ~/.config/opencode/opencode.json
cat: /home/risa/.config/opencode/opencode.json: No such file or directory

risa@RisaK-Desktop:~$ opencode auth list

┌  Credentials ~/.local/share/opencode/auth.json
│
●  OpenRouter api
│
●  OpenAI oauth
│
└  2 credentials

Plugins

None

OpenCode version

1.3.13

Steps to reproduce

  1. Authenticate with OpenAI (OAuth)
  2. Do opencode agent create --log-level=DEBUG --print-logs --pure --model openai/gpt-5.4
  3. Input any description, then enter.
  4. Error: LLM failed to generate agent: Bad Request

Screenshot and/or share link

No response

Operating System

Windows 11 WSL2 Ubuntu

Terminal

Windows Terminal

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcoreAnything pertaining to core functionality of the application (opencode server stuff)windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions