Skip to content

TUI half fails to load on OpenCode 2.4.x: "Cannot find package 'jsonc-parser'" (sidebar, /quota, status line missing) #531

Backlog

Description

@mororo250

Environment

  • OpenCode 2.4.3 (V2 CLI), Linux
  • @slkiser/opencode-quota 6.2.2 (checked the 6.3.0 tarball too: same import is present)
  • Plugin installed as a local package in ~/.config/opencode/plugins/opencode-quota (package.json with ./tui → dist/tui.js, node_modules/jsonc-parser@3.3.1 installed)

Symptom

After upgrading OpenCode, the quota sidebar panel, status line and /quota window stopped appearing. The server side keeps working; only the TUI half fails to set up. opencode plugin list shows only the server entry, @slkiser/opencode-quota.server.

Log output

WARN plugin operation failed  component=plugin stage=read
  error="Cannot find package 'jsonc-parser' imported from /home/user/.config/opencode/plugins/opencode-quota/dist/settings/schema.js"
  target=/home/user/.config/opencode/plugins/opencode-quota
  entrypoint=file:///home/user/.config/opencode/plugins/opencode-quota/dist/tui.js
  role=cli

The same warning repeats on every CLI plugin reconciliation. The server entrypoint (dist/index.js) loads without error.

Cause

The TUI entrypoint reaches these bare imports of jsonc-parser:

  • dist/settings/schema.js:8
  • dist/settings/convert.js:11
  • dist/settings/file.js:9
  • dist/lib/opencode-config-editor.js:3
  • dist/lib/opencode-config-files.js:19

The package's own node_modules/jsonc-parser is present and normal Node resolution from that file works:

node -e "import('./dist/settings/schema.js').then(() => console.log('ok'))"   # ok

But OpenCode's CLI TUI plugin loader (local discovery path, stage=read) does not resolve the plugin's own node_modules for non-peer bare specifiers — it can resolve the packages OpenCode provides (@opencode/plugin/tui, @opentui/*, solid-js) but not jsonc-parser, so importing dist/tui.js throws and the entire TUI half is discarded.

Workaround that works

Point the five imports at the vendored copy with a relative path:

import { getNodeValue } from "../../node_modules/jsonc-parser/lib/esm/main.js";

After a reload the CLI reconciliation completes with plugins=16 and no failures, and the sidebar, status line and /quota window come back.

Suggested fix

The TUI build should not contain bare, non-peer runtime imports:

  • Bundle jsonc-parser into the TUI dist (it is small, ~10 KB of ESM), or
  • re-export the required parser helpers from a relative module inside dist/, or
  • avoid the dependency in the TUI path entirely.

This likely affects any TUI plugin that keeps a non-peer runtime dependency external when loaded through local plugin discovery, so it may be worth a note in the README as well.

Happy to test a patched build against OpenCode 2.4.3 if that helps.

Activity

  1. added
    needs info
    on Dec 1, 2026
  2. github-actions commented on Dec 1, 2026

    @github-actions
    Contributor

    Thanks for opening this! This issue was not made with one of our forms, so we added the needs info label.

    Please open a new issue with a form: https://github.com/slkiser/opencode-quota/issues/new/choose. The forms ask for the details we need to help.

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

    needs info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions