Skip to content

Headless opencode run intermittently hangs at startup (log frozen at exactly 1,472 bytes, before any session/API activity) #36763

Closed as not planned

Description

@awswanson

Description

opencode run sometimes freezes at startup before creating a session row or making any API call. Without --print-logs we observed it repeatedly (~12 launches; one prompt went 3-for-3). With --print-logs it is much rarer but not eliminated — five occurrences to date where the log froze right after init + cleanup prune=7.days: no session row, no spend, 2+ minutes of nothing.

Consistent signature across the three most recent occurrences:

  • The frozen log is exactly 1,472 bytes.
  • The cleanup prune=7.days line lands ~60 s after init before the freeze (healthy runs: <1 s gap) — looks like a timeout being hit.
  • 4 of 5 occurred within minutes after a previous opencode process was killed (SIGTERM/pkill) — stale-state suspicion, though we found no lock files or leftover processes.

Kill and relaunch with the identical command clears it every time.

Expected: startup either proceeds or exits with an error. Suspected non-TTY output race or stale-state wait during init.

Not the same as #30337 (node_modules scanning) or #25668 (plugin loading, Windows) — this workspace has no .opencode/node_modules and no plugins. Possibly adjacent to #29395 (init deadlock), but here there is no concurrent instance running at launch time.

Workaround we use: always --print-logs; treat "no session row + no spend within ~60 s" as hung; kill and relaunch.

Plugins

None

OpenCode version

1.17.18

Steps to reproduce

Not deterministic. Shape: opencode run --print-logs --log-level INFO "<prompt>" > log 2>&1 in a fresh non-TTY shell, most reliably within a few minutes of killing a previous opencode process. Occasionally the log stops after the cleanup line at exactly 1,472 bytes.

Operating System

macOS (darwin 25.5.0), node v22.13.1

Terminal

Non-TTY (headless invocation)

Activity

  1. github-actions commented on Jul 13, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If this is the same root cause, please add a comment there rather than opening a new issue. If you believe this is distinct (e.g. the exact-1,472-byte log size and ~60 s cleanup delay point to a different code path), please clarify what differentiates it from #35870.

  2. github-actions commented on Sep 13, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions