Skip to content

NamedError hides data.message: Error.message is set to the tag name #31414

Closed as not planned

Description

@albertdbio

Description

NamedError — the base class for the serialized error union (ProviderAuthError, UnknownError, APIError, etc.) — sets Error.message to its own tag name. Its constructor calls super(name), so every instance ends up with Error.message === Error.name.

Because Cause.pretty and Error.prototype.toString() render an error as ${name}: ${message}, this comes out as ProviderAuthError: ProviderAuthError, and the real data.message is never shown.

Steps to reproduce

  1. Construct any NamedError, e.g. new ProviderAuthError({ providerID, message: "invalid token" }).
  2. Render it via Cause.pretty(Cause.fail(err)) or err.toString().
  3. Observe "ProviderAuthError: ProviderAuthError" — the "invalid token" detail is hidden.

OpenCode version

dev (current)

Activity

  1. github-actions commented on Jun 8, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to existing issues. Please check:

  2. github-actions commented on Aug 9, 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

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