Skip to content

bug: opencode 1.15.1 run exits with InstanceRef not provided #27829

@coygeek

Description

@coygeek

Summary

opencode run on opencode-ai 1.15.1 can create a session and then exit immediately with:

Error: Unexpected error, check log file at  for more details

InstanceRef not provided

The same command path works when pinned to opencode-ai@1.15.0, so this looks like a 1.15.1 headless-run regression.

Environment

opencode version: 1.15.1
os: Darwin 25.5.0 arm64
terminal: ghostty 1.3.1 / xterm-ghostty
provider/model: github-copilot/gpt-5.4

Reproduction

From an existing repo directory with normal OpenCode config/auth:

opencode run \
  --pure \
  --print-logs \
  --log-level DEBUG \
  --dir "$PWD" \
  -m github-copilot/gpt-5.4 \
  --variant high \
  --agent build \
  --dangerously-skip-permissions \
  'Say READY and stop.'

Observed with 1.15.1:

INFO ... service=session id=... version=1.15.1 ... created
INFO ... service=bus type=session.created publishing
INFO ... service=default ... disposing instance
ERROR ... message=InstanceRef not provided stack=Error: InstanceRef not provided
    at <anonymous> (/$bunfs/root/chunk-s9t5v9c2.js:679:76275)
    at ~effect/Effect/successCont (/$bunfs/root/chunk-jsc6q94x.js:25:7736)
    at runLoop (/$bunfs/root/chunk-jsc6q94x.js:25:2045)
    at evaluate (/$bunfs/root/chunk-jsc6q94x.js:25:1435)
    at <anonymous> (/$bunfs/root/src/index.js:91:12115)

I also reproduced the same InstanceRef not provided failure using a fresh isolated XDG data/cache/state directory, which suggests this is not just corruption in my existing OpenCode database.

Expected

The headless run command should continue after session creation, resolve tools, call the selected model, and print the model response.

Actual

1.15.1 creates the session.
2. Immediately disposes the instance.
3. Exits with InstanceRef not provided before the model call.

Workaround / regression check

Pinned 1.15.0 with the same normal OpenCode data/auth works:

npx -y opencode-ai@1.15.0 run \
  --pure \
  --print-logs \
  --log-level DEBUG \
  --dir "$PWD" \
  -m github-copilot/gpt-5.4 \
  --variant high \
  --agent build \
  --dangerously-skip-permissions \
  'Say READY and stop.'

1.15.0 output reaches the model and returns:

READY

A fresh isolated XDG data dir with 1.15.0 also gets past session creation and reaches the provider call; it then fails with missing required Authorization header, which is expected because that isolated data dir has no Copilot auth token. That still distinguishes the 1.15.1 InstanceRef crash from an auth failure.

Notes

This blocks automation that relies on non-interactive opencode run. For now I am pinning automation to npx -y opencode-ai@1.15.0 run while keeping the normal data directory so existing provider auth remains available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions