Skip to content

fix(#48716): Errors emitted on worker are not native errors#62865

Open
wongtimothy147-lgtm wants to merge 1 commit intonodejs:mainfrom
wongtimothy147-lgtm:autofix/48716-errors-emitted-on-worker-are-not-native
Open

fix(#48716): Errors emitted on worker are not native errors#62865
wongtimothy147-lgtm wants to merge 1 commit intonodejs:mainfrom
wongtimothy147-lgtm:autofix/48716-errors-emitted-on-worker-are-not-native

Conversation

@wongtimothy147-lgtm
Copy link
Copy Markdown

Closes #48716

Includes changes for Modify deserializeError to use Error constructor with proper arguments (name, message, options) inst


🤖 AI Transparency Notice

This PR was created by gh-autofix AI using holo3-35b-a3b.
A human reviewer should inspect before merging.


Root Cause

Error deserialization in lib/internal/error_serdes.js::deserializeError creates non-native Error instances using Object.create(Error.prototype) instead of proper constructor invocation, causing types.isNativeError() to return false.


Changes Made

lib/internal/error_serdes.js, test/parallel/test-worker-error-native.js


Fix Strategy

Modify deserializeError to use Error constructor with proper arguments (name, message, options) instead of Object.create, ensuring native error instances are created.


Testing

  • Test command: npm test
  • Environment: Linux (Node.js)

Review results: passed all tests


Files Changed

N/A


Review confidence: 90%

Notes: None

Automated fix for nodejs#48716.
See PR body for full analysis, test results, and AI disclosure.

AI-Assisted: true
Model: holo3-35b-a3b
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Apr 21, 2026
@MikeMcC399
Copy link
Copy Markdown
Contributor

Please check the guidelines

https://github.com/nodejs/node/blob/main/doc/contributing/pull-requests.md#commit-message-guidelines

concerning your commit message.

A human reviewer should inspect before merging.

You should confirm through your Signed-off-by that you are a human reviewer that has personally reviewed and tested the proposed changes.

Copy link
Copy Markdown
Contributor

@MikeMcC399 MikeMcC399 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

properties.cause.value = deserializeError(properties.cause.value);
}
return ObjectCreate(ctor.prototype, properties);
return new ctor(properties);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't just pass an error object's properties as the first argument to an Error constructor.

The correct approach is the one in #58605, which seemed to stall for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Errors emitted on worker are not native errors

4 participants