Skip to content

Bug: Plugin enabled causes startup crash: null is not an object (evaluating 'n.provider') at Provider.list (affects BOTH stable and dev channels) #45181

Closed as duplicate

Description

@kasirkupwa-commits

Environment

  • OS: Windows 11 (10.0.26100)
  • opencode versions tested (all crash identically):
    • 1.18.23 (stable, npm dist-tag latest)
    • 0.0.0-dev-202608241310
    • 0.0.0-dev-202608250823
    • 0.0.0-dev-202608251959 (dev dist-tag)
  • Runtime: bundled bun (B:/~BUN/root/chunk-*.js)
  • Install method: npm global (opencode-ai), upgrades via opencode upgrade

Repro

  1. Create a minimal plugin at ~/.config/opencode/plugin/my-plugin.ts:
export default async function myPlugin({ $, client }) {
  return {
    event: async ({ event }) => {},
  }
}
  1. Register it in opencode.jsonc:
{
  "plugin": ["./plugin/my-plugin.ts"]
}
  1. Launch opencode.

Result: TUI fails to start →

Error: Unexpected server error. Check server logs for details.
  1. Remove/comment the "plugin" line → launches normally every time.

Server log (--print-logs, stderr)

{"level":"ERROR","message":"failed","error":"TypeError: null is not an object (evaluating 'n.provider')","cause":"TypeError: null is not an object (evaluating 'n.provider')\n    at <anonymous> (B:/~BUN/root/chunk-mcbs1fvh.js:439:83422)\n    at Provider.list (B:/~BUN/root/chunk-jbrc4ckv.js:3:16007)\n    at Provider.list (definition) (B:/~BUN/root/chunk-mcbs1fvh.js:439:88460)\n    at ConfigHttpApi.providers (B:/~BUN/root/chunk-jbrc4ckv.js:2:84455)\n    at ConfigHttpApi.providers (definition) (B:/~BUN/root/chunk-jbrc4ckv.js:3:15949)"}
{"level":"ERROR","message":"plugin dispose hook failed","error":"null is not an object (evaluating 'N.dispose')"}

Observations

  • Reproduces on the stable channel (1.18.23) — not a dev-only regression. Tested via clean opencode upgrade 1.18.23 + plugin enabled → same crash; plugin disabled → healthy.
  • Crash occurs during Provider.list / ConfigHttpApi.providers while the plugin config hook path runs — appears to be a null provider object being dereferenced when plugins are present.
  • Identical across four builds spanning three days, so not transient.
  • Also reproduces with my real-world plugin (brain-auto.ts, uses event hook + client), not just the minimal one.
  • With plugin disabled, zero errors across many sessions on every version.

Expected

Plugin registration should not crash provider enumeration; worst case the plugin errors should be isolated/logged without taking down the TUI.

Activity

  1. github-actions commented on Aug 26, 2026

    @github-actions
    Contributor

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

  2. kasirkupwa-commits commented on Aug 26, 2026

    @kasirkupwa-commits
    Author

    Confirmed — same root cause on our side. Our plugin (�rain-auto.ts, ~550 lines) exported 7 functions: the real default factory plus 6 named helpers (stripCode,
    rfFuse, computeConfidence, shouldSkipHybrid, matchFeedback,
    ecallBlock). The legacy loader invoked all of them → identical
    .provider crash in Provider.list.

    Workaround validated on both

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