anomalyco / anomalyco/opencode

opencode run --format json fails with UnknownError (1.18.23 → 1.18.29)

Open
#47,972 1 comment 0 reactions 1 assignee View on GitHub

@neriousy is already working on this.

Since Sep 8, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Summary

opencode run --format json consistently fails with UnknownError, making the JSON output mode unusable for programmatic consumption.

Version

$ opencode --version
1.18.29

Originally observed on v1.18.23; still reproduces identically on v1.18.29. Platform: macOS (arm64).

Repro

$ opencode run --format json "reply with the single word ok"
{"type":"error","timestamp":1788875942731,"sessionID":"ses_f7eaf57b4ffeRoCprFrTfUsZZJ","error":{"name":"UnknownError","data":{"message":"Unexpected server error. Check server logs for details.","ref":"err_4014dc86"}}}
$ echo $?
1

Notes

  • Reproduced identically on v1.18.23 in both standalone mode and opencode run --attach --format json.
  • Verified again on v1.18.29 (standalone mode) on 2026-09-08 with OPENCODE/OPENCODE_AUTO env vars unset (i.e. not nested inside an existing opencode session).
  • Exit code 1, no JSON result payload is ever emitted — only the error line.
  • This blocks any tooling that spawns opencode run --format json and parses stdout for events/messages (e.g. driving opencode sessions programmatically).
Plugins

No response

OpenCode version

1.18.29

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Ghostyy

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.