Skip to content

Error.isError does not detect legacy Error types using util.inherits #62224

@arciisine

Description

@arciisine

Version

v25.8.0

Platform

Darwin mac.lan 25.3.0 Darwin Kernel Version 25.3.0: Wed Jan 28 20:55:08 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6020 arm64

Subsystem

No response

What steps will reproduce the bug?

Sample REPL output

> function CustomError() {}
undefined
> require('util').inherits(CustomError, Error);
undefined
> new CustomError() instanceof Error
true
> Error.isError(CustomError)
false

How often does it reproduce? Is there a required condition?

This happens 100% of the time

What is the expected behavior? Why is that the expected behavior?

Error.isError is meant to be a more robust replacement for Error detection vs instanceof. It should work consistently with legacy node patterns utils.inherits, without surprise.

What do you see instead?

Error.isError does not detect error types that rely on utils.inherits for extension. instanceof Error does still work in these scenarios.

Additional information

The es-shim, https://github.com/es-shims/Error.isError/blob/main/implementation.js#L64 , has the instanceof Error behavior as the final fallback, which would catch this behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions