Skip to content

bug: opencode run hangs when encountering certain errors instead of exiting #4506

Closed

Description

@sheldonhull

Description

I'm running opencode in a CI context, and it never proceeds past the first logging message until the timeout on the CI job executes the termination of the task. Then I see the initial output logs for installing the basic plugins.

✅ OPENCODE_CONFIG preset to /home/vsts/work/1/autopilot/opencode.jsonc
✅ OPENCODE_CONFIG_DIR preset to /home/vsts/work/1/autopilot/
✅ Using cached opencode
Running opencode command 'pr-review' with title 'PR Review: 111111'
opencode run "start evaluation and commentary on pr, in CI, so self solve all problems to finish review" --command "pr-review" --agent "default" --title "PR Review: 111111" --log-level "DEBUG" --print-logs
INFO  2025-11-19T19:04:11 +251ms service=default version=1.0.78 args=["run","start evaluation and commentary on pr, in CI, so self solve all problems to finish review","--command","pr-review","--agent","default","--title","PR Review: 111111","--log-level","DEBUG","--print-logs"] opencode

The error comes back with: Error: Command "pr-review" not found

I have created the file: $OPENCODE_CONFIG_DIR/command/pr-review.md.

When I use this same setup locally I do get further output.

  • I've configured all the Azure OpenAI model info and simulated running locally and it at least invokes the command.
  • I tried removing every MCP server, and it made no difference to the startup.
  • I made sure AZURE_API_KEY and AZURE_RESOURCE_NAME were set, and set my OPENCODE_CONFIG and OPENCODE_CONFIG_DIR to the repo path as cloned.
  • The model is accessible and confirmed to be deployed.
  • I also manually ran the npm install of the setup packages to try and make sure these weren't negatively impacting the agent startup.
  1. Even though I'm running with --log-level DEBUG --print-logs it shows no activity until terminated. Should I be redirecting to stderr or something for it show up while running?
  2. What's the most likely issue with my command not being found?

OpenCode version

1.0.78

UPDATE

  • /home/vsts/work/1/autopilot/ should be /home/vsts/work/1/autopilot/.opencode and /home/vsts/work/1/autopilot/.opencode/opencode.jsonc I bet that simple typo got me.
  • Will confirm and if so, then this would be great to have a early failure when config is not found rather than just timing out stuck.

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 19, 2025
  2. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 19, 2025
  3. self-assigned this
    on Nov 19, 2025
  4. changed the title [-]Opencode run hanging in CI, and then upon termination saying can't find a command[/-] [+]bug: opencode run hangs when encountering certain errors instead of exiting[/+] on Nov 26, 2025
  5. rwese commented on Nov 28, 2025

    @rwese
    Contributor

    I tried to reproduce your issue and found that the command as you had it did not work. Also you must redirect the output, if your logging does not already capture stderr, as most informative/debug output is usually written to stdout to not clutter the stdout which will be processed.

    You may replace bun run dev with opencode, and the paths with your local systems.

    This is my attempt, see logfile.

    #!/bin/bash
    OPENCODE_CONFIG=~/.config/opencode/opencode.json
    OPENCODE_CONFIG_DIR=~/.config/opencode
    
    # opencode expects the prompt for direct evaluation to come from STDIN
    echo "start evaluation and commentary on pr, in CI, so self solve all problems to finish review" |
    bun run dev -- run --command "pr-review" --log-level "DEBUG" --agent plan --print-logs 2>&1
    

    i changed the agent for my testing, and removed the --prompt.
    i created ~/.config/opencode/command/pr-review.md.

    see attached log, let me know if I got you wrong.

    pipeline_command_log.gz

  6. sheldonhull commented on Dec 9, 2025

    @sheldonhull
    Author

    Ok, thanks to your suggestions I have it running. Thank you for clarifying!

  7. added 3 commits that reference this issue on Feb 11, 2026
    0a0a42a
    1f8fde0
    ec45dfd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions