Skip to content

readV1Plugin detect mode throws TypeError for TUI-only plugins loaded as server plugins #31610

Closed as not planned

Description

@caniko

Problem

When a file-based TUI-only plugin (one that exports { id, tui } but not server) is configured via settings.plugin, the server plugin loader (plugin/index.ts) calls readV1Plugin(mod, spec, "server", "detect").

The detect-mode guard at shared.ts:283 only short-circuits when all three fields (id, server, tui) are absent. Since id and tui are present, the function proceeds to the kind-specific check at line 296 and throws:

TypeError: Plugin ... must default export an object with server()

This error is caught and logged at ERROR level, producing noisy and misleading log output.

Expected behavior

readV1Plugin with mode = "detect" should silently skip plugins that do not have the entrypoint for the requested kind. A TUI-only plugin should be skipped when kind = "server" and vice versa.

Proposed fix

Add two short-circuit guards after the existing detect check:

if (mode === "detect" && kind === "server" && !("server" in value)) return
if (mode === "detect" && kind === "tui" && !("tui" in value)) return

See PR #31552 for the implementation (currently closed pending this issue).

Activity

  1. kagura-chen commented on Jun 10, 2026

    @kagura-chen
    Contributor

    I'd like to work on this. The fix is clear from the issue description — add two short-circuit guards in readV1Plugin for detect mode when the requested kind's entrypoint is missing. Will submit a PR referencing this issue.

  2. added a commit that references this issue on Jul 30, 2026
    e8ed172
  3. github-actions commented on Aug 10, 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

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