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

Closed
opened 2026-02-16 17:38:07 -05:00 by yindo · 2 comments
Owner

Originally created by @sheldonhull on GitHub (Nov 19, 2025).

Originally assigned to: @rekram1-node on GitHub.

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.
Originally created by @sheldonhull on GitHub (Nov 19, 2025). Originally assigned to: @rekram1-node on GitHub. ### 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.
yindo added the help-wantedbuggood first issue labels 2026-02-16 17:38:07 -05:00
yindo closed this issue 2026-02-16 17:38:07 -05:00
Author
Owner

@rwese commented on GitHub (Nov 28, 2025):

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

@rwese commented on GitHub (Nov 28, 2025): 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](https://github.com/user-attachments/files/23825432/pipeline_command_log.gz)
Author
Owner

@sheldonhull commented on GitHub (Dec 8, 2025):

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

@sheldonhull commented on GitHub (Dec 8, 2025): Ok, thanks to your suggestions I have it running. Thank you for clarifying!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2979