Skip to content

core: instruction initialization blocked by unavailable sources (Maximum call stack size exceeded) #50296

Description

@seiya4444

Summary

Every session fails to start with Instructions.InitializationBlocked: Instruction initialization blocked by unavailable sources: core/instructions. The root cause is a RangeError: Maximum call stack size exceeded (stack overflow) in the core/instructions source activation code. This affects both the shared background service and --standalone mode.

Environment

  • opencode version: 2.0.11 (latest, channel=latest)
  • OS: Windows 11 Pro, Build 22631, x64
  • Terminal: Windows Terminal / PowerShell 7
  • Shell: C:\WINDOWS\system32\cmd.exe / PowerShell 7
  • Install/channel: npm global install (@opencode/cli@2.0.11)
  • Active plugins: postgres (local plugin at ~/.config/opencode/plugins/postgres), herdr-agent-state.js, i-have-adhd.js

Reproduction

  1. Install OpenCode v2.0.11 via npm (npm install -g @opencode/cli)
  2. Run opencode (or opencode --standalone)
  3. Create a new session
  4. Session immediately fails with the error below

Expected Behavior

Session should start normally and process messages.

Actual Behavior

Every session fails immediately on creation. The logs show:

WARN  "failed to activate instruction source"
      cause="Cause([Die(RangeError: Maximum call stack size exceeded.)])"

ERROR "Failed to drain Session"
      cause="Instructions.InitializationBlocked: Instruction initialization
      blocked by unavailable sources: core/instructions
          at FE (chunk-1sa5rvxc.js:30:42285)
          at InstructionState.observe (chunk-1sa5rvxc.js:32:1283)
          at InstructionState.prepare (chunk-vyhk950s.js:365:2744)
          at SessionRunner.prepareContext (chunk-vyhk950s.js:365:2321)
          at SessionRunner.advanceToStep (chunk-vyhk950s.js:365:2583)
          at SessionRunner.drain (chunk-24mc5jhy.js:24:2279)"

This happens consistently across:

  • Multiple project directories
  • Both shared service and --standalone mode
  • After service restart (opencode service stop + restart)
  • After full computer restart

Additional Context

  • The core/instructions source crashes with infinite recursion before it can be marked as available, which then blocks session initialization.
  • Workaround attempted: opencode --standalone — same error occurs.
  • Config file is minimal (~/.config/opencode/opencode.json), AGENTS.md is only 756 bytes (16 lines).
  • Full log available at ~/.local/share/opencode/log/opencode.log (~45MB).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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