Skip to content

Error subclasses have no .stack — 93 extends Error in the cc bundle, stack traces missing from user-facing errors #9410

Description

@proggeramlug
class A extends Error {}
new A("x").stack                            // node: string   perry: undefined
Object.prototype.toString.call(new A("x"))  // node: "[object Error]"   perry: "[object Object]"
new Error("x").stack                        // both: string  <-- the BASE class is fine

Only subclasses are affected, which localises this to whatever Error construction does for a derived class.

User-visible consequence in cc

claude doctor and claude --max-budget-usd abc print, under node, ~10 real frames with source positions — 14,573 bytes of stderr. Under perry the same commands print - at <anonymous> and 120 bytes. The bundle has 93 extends Error classes and 106 .stack uses, so essentially every diagnostic cc emits loses its trace.

The toString tag divergence is likely the same root: a derived Error isn't being branded as an Error.

Found by a differential stress-test of claude-code under perry.

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