Skip to content

Plugin loader: activate() failure wrap drops err.code — FST_ERR_DUPLICATED_ROUTE only identifiable by string-matching #599

Open

Description

@melvincarvalho

What happens

When a plugin's activate() throws — e.g. a route collision with another plugin — the loader re-wraps the error as:

plugin <id>: activate() failed: Method 'GET' already declared for route '/.well-known/webfinger'

The original error's code (FST_ERR_DUPLICATED_ROUTE) is stripped in the wrap, so callers and tests can only string-match the message to distinguish a route collision from any other activation failure.

Evidence

Witnessed while deliberately colliding two plugins on /.well-known/webfinger (webfinger + remotestorage): https://github.com/JavaScriptSolidServer/plugins/tree/gh-pages/remotestorage (README, Findings — the collision test asserts on the message because the code is gone). Also REPORT.md there, bug #4.

Suggested fix

Preserve the original error when re-wrapping: copy code onto the wrapper, or use new Error(msg, { cause: err }) so both the code and the stack survive.

Activity

  1. added
    bug
    plugin
    on Jul 11, 2026
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

    bugplugin

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions