Title: assert: deepStrictEqual throws RangeError for an Error with a self-referencing cause · Issue #67572 · nodejs/node · GitHub
Open Graph Title: assert: deepStrictEqual throws RangeError for an Error with a self-referencing cause · Issue #67572 · nodejs/node
X Title: assert: deepStrictEqual throws RangeError for an Error with a self-referencing cause · Issue #67572 · nodejs/node
Description: Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem assert What steps will reproduce the bug? Save as repro.cjs: const assert = require('node:assert'); const a = new Error('a'); a.cause = ...
Open Graph Description: Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem assert What steps will reproduce the bug? Save as repro.cjs: const assert = require('node:assert...
X Description: Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem assert What steps will reproduce the bug? Save as repro.cjs: const assert = require('node:as...
Opengraph URL: https://github.com/nodejs/node/issues/67572
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"assert: deepStrictEqual throws RangeError for an Error with a self-referencing cause","articleBody":"### Version\n\nNode.js v24.22.2, v26.13.0 and v26.13.1\n\n### Platform\n\n```text\nmacOS 15.2, Darwin 24.2.0, arm64.\n```\n\n### Subsystem\n\nassert\n\n### What steps will reproduce the bug?\n\nSave as `repro.cjs`:\n\n```js\nconst assert = require('node:assert');\nconst a = new Error('a');\na.cause = a;\ntry {\n assert.deepStrictEqual(a, new Error('b'));\n console.log('no error');\n} catch (error) {\n console.log('type:', error.name);\n console.log('code:', error.code);\n console.log('is AssertionError:', error instanceof assert.AssertionError);\n}\n```\n\nRun:\n\n```sh\nnode repro.cjs\n```\n\n### How often does it reproduce? Is there a required condition?\n\nEvery run when a failing comparison involves an Error whose cause refers back to itself.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n```text\ntype: AssertionError\ncode: ERR_ASSERTION\nis AssertionError: true\n```\n\nThe [assert.deepStrictEqual documentation](https://nodejs.org/api/assert.html#assertdeepstrictequalactual-expected-message) specifies an AssertionError for unequal values and supports circular inputs. The errors have different messages, so this assertion should fail normally rather than overflow while formatting the failure.\n\n### What do you see instead?\n\nThe listed versions produce:\n\n```text\ntype: RangeError\ncode: undefined\nis AssertionError: false\n```\n\n### Additional information\n\nThe recursion appears to be in [copyError](https://github.com/nodejs/node/blob/v26.13.1/lib/internal/assert/assertion_error.js): an Error-valued cause is copied recursively without tracking previously visited errors.\n\nAI tools assisted with analysis and preparation of this report and its reproduction. A human has reviewed and confirmed the issue and verified that it is reproducible.\n\nCredit: UCSB PLSE — https://ucsbplse.github.io/","author":{"url":"https://github.com/archidoge0","@type":"Person","name":"archidoge0"},"datePublished":"2026-11-18T12:57:56Z","url":"https://github.com/nodejs/node/issues/67572"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1b3018d7-c094-7aa0-d0af-f29473c60faf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DBE:32CBBB:3AD806:4D1D95:6B0619A3 |
| html-safe-nonce | 5078b434ce7350ef5764e1712fec28ccf7cb3b28e0cd060f4782df1f33dde67a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REJFOjMyQ0JCQjozQUQ4MDY6NEQxRDk1OjZCMDYxOUEzIiwidmlzaXRvcl9pZCI6IjU2MTk4OTYxMjIyNzg4MTIwNjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a58dcb7e6b84f537e069f8f167a43afe4534bd22c92492ba379296bcbcac8a24 |
| hovercard-subject-tag | issue:6467652897 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/67572/issue_layout |
| twitter:image | https://opengraph.githubassets.com/00099014efd68ba2f4df2ccb97b7f579a2ccf4a7488dbc3e5d7b0bdef79266ee/nodejs/node/issues/67572 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/00099014efd68ba2f4df2ccb97b7f579a2ccf4a7488dbc3e5d7b0bdef79266ee/nodejs/node/issues/67572 |
| og:image:alt | Version Node.js v24.22.2, v26.13.0 and v26.13.1 Platform macOS 15.2, Darwin 24.2.0, arm64. Subsystem assert What steps will reproduce the bug? Save as repro.cjs: const assert = require('node:assert... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | archidoge0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 97d4714e567728e1f85f88b0cf68c89f0f8a3dc41e8869af7aeb8195ad990374 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 866f202ebf7ac5aff8f633417d9fd8a53818a977 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width