Skip to content

Requests always timeout on opencode cli #56371

Closed as not planned
Closed as not planned

Description

@ChrisGamer5013

Description

opencode always time out due to misisng resposne headers

Plugins

none

OpenCode version

2.0.32

Steps to reproduce

open opencode via npm in windows terminal
select any nvidia nim model
see this error Retry due · attempt 2 · Timed out waiting for response headers
wait until attempt 5 then
Error: Timed out waiting for response headers

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Windows Terminal

Activity

  1. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Thanks for the report! The error Timed out waiting for response headers means NVIDIA's API didn't send any response before OpenCode's header timeout ran out. By default that timeout is 5 minutes, or less if a timeout is set in your provider settings. To work out whether this is an OpenCode problem or the endpoint not responding, could you share:

    1. Which models you tried (the exact model IDs), and whether you're using the built-in nvidia provider (set up with /connect) or a custom provider in your config.
    2. Timing: about how long does each attempt take before the retry message appears? Roughly 5 minutes, or a few seconds?
    3. Your provider config: the provider section of your opencode.json/opencode.jsonc, if you have one. Please remove your API key first. Settings like timeout or headerTimeout matter here.
    4. Whether the API works outside OpenCode, e.g.:
      curl https://integrate.api.nvidia.com/v1/chat/completions -H "Authorization: Bearer %NVIDIA_API_KEY%" -H "Content-Type: application/json" -d "{\"model\":\"<model-id>\",\"messages\":[{\"role\":\"user\",\"content\":\"hi\"}]}"
      
      Also, are you behind a proxy or VPN?
    5. Logs from a failing attempt, if you can get them.

    You can reply here with the details, or edit the issue. If you edit it, please also leave a comment saying you've updated it so we know you're done.

    I didn't find an exact duplicate, but these related issues may help (ordered by likelihood):

  2. ChrisGamer5013 commented on Oct 17, 2026

    @ChrisGamer5013
    Author
    1. yes i used the /connect inside the cli and pasted in my api key
    2. each attempt takes 5 minnutes and after 25 minutes it erros out compeletly
    3. no opencode.json was made
    4. not tested and no proxy nor vpn
    5. where are the logs?
  3. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Thanks for the quick answers, that helps! About 5 minutes per attempt matches OpenCode's default response-header timeout. So NVIDIA's API accepts each request but never starts answering. Now we need to tell whether NVIDIA's endpoint is slow or stuck, or whether something in the request OpenCode sends is the problem. Could you share:

    1. The exact model(s) you selected, e.g. as shown in the model picker or the model ID.
    2. A direct test outside OpenCode. In Windows Terminal (PowerShell), with your key in place of nvapi-... and the model ID from step 1:
      curl.exe https://integrate.api.nvidia.com/v1/chat/completions -H "Authorization: Bearer nvapi-..." -H "Content-Type: application/json" -d '{\"model\":\"<model-id>\",\"messages\":[{\"role\":\"user\",\"content\":\"hi\"}]}'
      Does it answer quickly, hang, or return an error? Please don't paste your API key here.
    3. Logs: run opencode debug paths log to see the log folder. The file is opencode.log in that folder, usually %USERPROFILE%\.local\share\opencode\log\opencode.log. Please attach the lines from a failing attempt, mainly those with role=server that mention the provider or the timeout. Remove any API keys or authorization headers before sharing.

    You can reply here or edit the issue. If you edit it, please leave a comment so we know it's updated.

  4. ChrisGamer5013 commented on Oct 17, 2026

    @ChrisGamer5013
    Author
    1. it says 04 page not found when trying to use said comand with api key
    2. and part of the logs hope it helps
      timestamp=2026-10-17T10:30:54.637Z level=INFO run=c11bcef3 message=event event.id=evt_1496a21ad001PGp5QQyhW4vF0F event.created=1792233054637 event.type=provider.updated event.location.directory="C:\Users\chris" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T10:30:54.669Z level=INFO run=c11bcef3 message=event event.id=evt_1496a21cd001w2BfzPZKJM36u4 event.created=1792233054669 event.type=model.updated event.location.directory="C:\Users\chris" event.location.workspaceID=undefined event.data={} http.span=3001783 role=server
      timestamp=2026-10-17T10:30:57.222Z level=INFO run=c11bcef3 message=event event.id=evt_1496a2bc50016yyevB54CBFLO6 event.created=1792233057221 event.type=provider.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T10:30:57.272Z level=INFO run=c11bcef3 message=event event.id=evt_1496a2bf8001UVizoqNmaXpKzJ event.created=1792233057272 event.type=model.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={} http.span=3001894 role=server
      timestamp=2026-10-17T10:30:59.270Z level=INFO run=c11bcef3 message=event event.id=evt_1496a33c6001D3gAlbc8UjfZin event.created=1792233059270 event.type=provider.updated event.location.directory="C:\Users\chris" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T10:30:59.287Z level=INFO run=c11bcef3 message=event event.id=evt_1496a33d6001JCz60IMI2Cq5h0 event.created=1792233059286 event.type=model.updated event.location.directory="C:\Users\chris" event.location.workspaceID=undefined event.data={} http.span=3006401 role=server
      timestamp=2026-10-17T10:31:20.021Z level=INFO run=34544269 message="spawning process" command=npm args="["list","-g","--depth=0","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T10:31:20.043Z level=INFO run=34544269 message="spawning process" command=pnpm args="["list","-g","--depth=0","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T10:31:20.070Z level=INFO run=34544269 message="spawning process" command=bun args="["pm","ls","-g"]" cwd=undefined role=cli
      timestamp=2026-10-17T10:31:20.100Z level=INFO run=34544269 message="spawning process" command=yarn args="["global","list"]" cwd=undefined role=cli
      timestamp=2026-10-17T10:31:20.119Z level=INFO run=34544269 message="spawning process" command=vp args="["list","-g","--json","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T10:31:22.257Z level=INFO run=34544269 message="update check" current=2.0.32 latest=2.0.32 role=cli
      timestamp=2026-10-17T10:31:22.257Z level=INFO run=34544269 message="update check done" action=up-to-date role=cli
      timestamp=2026-10-17T10:35:20.507Z level=INFO run=c11bcef3 message="spawning process" command="C:\Program Files\Git\cmd\git.EXE" args="["--git-dir","C:\\Users\\chris\\.local\\share\\opencode\\snapshot\\47979c6e4ab2d40d7971d36f77eb1399a32b354d\\20f2a6c0afe08f4d9a8952f6a16c9dc1cb5b7632","--work-tree","D:\\audio upscale","diff-files","--name-only","-z","--",":(literal)."]" cwd="D:\audio upscale" role=server
      timestamp=2026-10-17T10:35:20.517Z level=INFO run=c11bcef3 message="spawning process" command="C:\Program Files\Git\cmd\git.EXE" args="["--git-dir","C:\\Users\\chris\\.local\\share\\opencode\\snapshot\\47979c6e4ab2d40d7971d36f77eb1399a32b354d\\20f2a6c0afe08f4d9a8952f6a16c9dc1cb5b7632","--work-tree","D:\\audio upscale","ls-files","--others","--exclude-standard","-z","--",":(literal)."]" cwd="D:\audio upscale" role=server
      timestamp=2026-10-17T10:35:54.682Z level=INFO run=c11bcef3 message=event event.id=evt_1496eb5ba001iBlY5oXwCcb4Yj event.created=1792233354682 event.type=provider.updated event.location.directory="C:\Users\chris" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T10:35:54.710Z level=INFO run=c11bcef3 message=event event.id=evt_1496eb5d6001ie98hO55ajTkEg event.created=1792233354710 event.type=model.updated event.location.directory="C:\Users\chris" event.location.workspaceID=undefined event.data={} http.span=3301824 role=server
      timestamp=2026-10-17T10:35:57.262Z level=INFO run=c11bcef3 message=event event.id=evt_1496ebfce001EKyHon0BX0ul4a event.created=1792233357262 event.type=provider.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T10:35:57.293Z level=INFO run=c11bcef3 message=event event.id=evt_1496ebfed001KK4FylbzRnmA9g event.created=1792233357293 event.type=model.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={} http.span=3301915 role=server
      timestamp=2026-10-17T10:38:55.660Z level=INFO run=12833f68 message="cli starting" version=2.0.32 channel=latest local=false args="["debug","path","logs"]" role=cli
      timestamp=2026-10-17T10:38:55.672Z level=ERROR run=12833f68 message="cli process failed" cause="Cause([Fail(~effect/cli/CliError/ShowHelp: Help requested)])" args="["debug","path","logs"]" role=cli
      timestamp=2026-10-17T10:39:00.144Z level=INFO run=5bc113d5 message="cli starting" version=2.0.32 channel=latest local=false args="["debug","path","log"]" role=cli
      timestamp=2026-10-17T10:39:00.151Z level=ERROR run=5bc113d5 message="cli process failed" cause="Cause([Fail(~effect/cli/CliError/ShowHelp: Help requested)])" args="["debug","path","log"]" role=cli
      timestamp=2026-10-17T10:39:09.449Z level=INFO run=5c92c6a7 message="cli starting" version=2.0.32 channel=latest local=false args="["debug","paths","log"]" role=cli
  5. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Thanks for trying those!

    About the 404: a plain 404 page not found usually means the request didn't reach the right endpoint in the right shape. PowerShell's handling of quotes in curl commands often causes this, as does leaving <model-id> in the command as written. Could you try this PowerShell version instead? It avoids the quoting problem. Put the model you picked in OpenCode in place of <model-id> (e.g. meta/llama-3.1-8b-instruct) and your key in place of nvapi-...:

    $body = @{ model = "<model-id>"; messages = @(@{ role = "user"; content = "hi" }) } | ConvertTo-Json -Depth 5
    Invoke-RestMethod -Uri https://integrate.api.nvidia.com/v1/chat/completions -Method Post -Headers @{ Authorization = "Bearer nvapi-..." } -ContentType "application/json" -Body $body

    Does it answer within a few seconds, hang, or show an error? Please don't paste your API key here.

    Which model: please also tell us the exact model name or ID you selected in OpenCode. We still need this to try it ourselves.

    About the logs: thanks, though at the default level they don't include the provider request. Could you run one failing attempt with debug logging, in a private server so the setting takes effect?

    $env:OPENCODE_LOG_LEVEL = "DEBUG"
    opencode --standalone

    Send one message to the NVIDIA model and wait for the first Retry (about 5 minutes). Then share the opencode.log lines from that time, mainly those with role=server that mention the provider, nvidia, or the timeout. Please remove any API keys or Authorization headers first.

  6. ChrisGamer5013 commented on Oct 17, 2026

    @ChrisGamer5013
    Author
    1. hangs infinietly
    2. the logs with server roel
      timestamp=2026-10-17T15:32:23.350Z level=INFO run=34544269 message="update check" current=2.0.32 latest=2.0.32 role=cli
      timestamp=2026-10-17T15:32:23.351Z level=INFO run=34544269 message="update check done" action=up-to-date role=cli
      timestamp=2026-10-17T15:34:15.496Z level=INFO run=d015c951 message=event event.id=evt_14a7fdac6001h1obKSSenH92q5 event.created=1792251255494 event.type=provider.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T15:34:15.541Z level=INFO run=d015c951 message=event event.id=evt_14a7fdaf5001zrFeONBat0AyHt event.created=1792251255541 event.type=model.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={} http.span=4203017 role=server
      timestamp=2026-10-17T15:39:15.589Z level=INFO run=d015c951 message=event event.id=evt_14a846f04001sIJfLDNiZvq600 event.created=1792251555589 event.type=provider.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T15:39:15.627Z level=INFO run=d015c951 message=event event.id=evt_14a846f2b001ytKlFDxPSQMXJC event.created=1792251555627 event.type=model.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={} http.span=4503103 role=server
      timestamp=2026-10-17T15:40:22.067Z level=INFO run=b8dcf954 message="spawning process" command=npm args="["list","-g","--depth=0","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:40:22.086Z level=INFO run=b8dcf954 message="spawning process" command=pnpm args="["list","-g","--depth=0","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:40:22.112Z level=INFO run=b8dcf954 message="spawning process" command=bun args="["pm","ls","-g"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:40:22.133Z level=INFO run=b8dcf954 message="spawning process" command=yarn args="["global","list"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:40:22.149Z level=INFO run=b8dcf954 message="spawning process" command=vp args="["list","-g","--json","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:40:24.051Z level=INFO run=b8dcf954 message="update check" current=2.0.32 latest=2.0.32 role=cli
      timestamp=2026-10-17T15:40:24.051Z level=INFO run=b8dcf954 message="update check done" action=up-to-date role=cli
      timestamp=2026-10-17T15:42:23.356Z level=INFO run=34544269 message="spawning process" command=npm args="["list","-g","--depth=0","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:42:23.373Z level=INFO run=34544269 message="spawning process" command=pnpm args="["list","-g","--depth=0","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:42:23.398Z level=INFO run=34544269 message="spawning process" command=bun args="["pm","ls","-g"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:42:23.424Z level=INFO run=34544269 message="spawning process" command=yarn args="["global","list"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:42:23.441Z level=INFO run=34544269 message="spawning process" command=vp args="["list","-g","--json","@opencode/cli"]" cwd=undefined role=cli
      timestamp=2026-10-17T15:42:25.371Z level=INFO run=34544269 message="update check" current=2.0.32 latest=2.0.32 role=cli
      timestamp=2026-10-17T15:42:25.371Z level=INFO run=34544269 message="update check done" action=up-to-date role=cli
      timestamp=2026-10-17T15:44:15.684Z level=INFO run=d015c951 message=event event.id=evt_14a890343001odMzO1QdbEFmDB event.created=1792251855683 event.type=provider.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={}
      timestamp=2026-10-17T15:44:15.736Z level=INFO run=d015c951 message=event event.id=evt_14a890377001yawdP6pGICtjYm event.created=1792251855736 event.type=model.updated event.location.directory="D:\audio upscale" event.location.workspaceID=undefined event.data={} http.span=4803212 role=server
      timestamp=2026-10-17T15:47:09.188Z level=DEBUG run=b8dcf954 message=event component=client type=session.viewed aggregateID=ses_edeadcadeffe03lMuQ9TAnY3OQ seq=2616 role=cli
  7. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Thanks for running that test, it answers the question. Your direct request to NVIDIA's API, made without OpenCode, also hangs indefinitely. That means NVIDIA's endpoint isn't responding to your account or model right now, so this doesn't look like an OpenCode bug. OpenCode waits 5 minutes for the provider to start responding, retries a few times, then shows Timed out waiting for response headers. With an endpoint that never answers, that's the expected result.

    Things that may help on NVIDIA's side:

    • Try a different, smaller model in the same test (e.g. meta/llama-3.1-8b-instruct). Free endpoints on build.nvidia.com can be overloaded or queued for popular models.
    • Check your account on build.nvidia.com: whether your API key is still valid, whether you have credits or quota left, and whether the model you picked is still available.

    If you find a model that answers the direct test quickly but still times out in OpenCode, please reply here with that model ID and we'll look into it. Otherwise this issue will be closed automatically, since the problem looks to be with the provider.

  8. kawpii commented on Oct 18, 2026

    @kawpii
    ❯ opencode          
    Starting background server...
    Error: Timed out waiting for the background service to start
        at <anonymous> (/$bunfs/root/chunk-mtkfx0g6.js:3:6979)
        at service.ensure (/$bunfs/root/chunk-bsm4erxq.js:3:690)
        at service.ensure (definition) (/$bunfs/root/chunk-mtkfx0g6.js:3:5523)
        at cli.server-connection.resolve (/$bunfs/root/chunk-ex8cqpvg.js:96:6563)
        at cli.server-connection.resolve (definition) (/$bunfs/root/chunk-bsm4erxq.js:2:402)
    
  9. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Your direct test also hangs when calling NVIDIA's API without OpenCode, so the reported provider timeout is not specific to OpenCode. Please contact NVIDIA's API support; if a direct request succeeds but the same model still times out in OpenCode, please open a new issue with that comparison.

  10. opencode-agent commented on Oct 20, 2026

    @opencode-agent
    Contributor

    Closing this for now, since there's been no reply. Your direct test to NVIDIA's API, made without OpenCode, also hung indefinitely. So the Timed out waiting for response headers errors look like NVIDIA's endpoint not responding for that model or account, not an OpenCode bug. OpenCode waits 5 minutes for a response, retries, and then shows this error.

    If you find a model that answers the direct test quickly but still times out in OpenCode, please comment here with the model ID or open a new issue, and we'll take another look. Thanks for working through the diagnostics!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions