Title: `util.inspect` crashes with a getter whose `error.message` throws · Issue #60683 · nodejs/node · GitHub
Open Graph Title: `util.inspect` crashes with a getter whose `error.message` throws · Issue #60683 · nodejs/node
X Title: `util.inspect` crashes with a getter whose `error.message` throws · Issue #60683 · nodejs/node
Description: Version v20.19.5, v22.19.0, v24.8.0 Platform Darwin MacBook-Pro-M1.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsystem Util What steps will reproduce the bu...
Open Graph Description: Version v20.19.5, v22.19.0, v24.8.0 Platform Darwin MacBook-Pro-M1.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsyst...
X Description: Version v20.19.5, v22.19.0, v24.8.0 Platform Darwin MacBook-Pro-M1.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsyst...
Opengraph URL: https://github.com/nodejs/node/issues/60683
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`util.inspect` crashes with a getter whose `error.message` throws","articleBody":"### Version\n\nv20.19.5, v22.19.0, v24.8.0\n\n### Platform\n\n```text\nDarwin MacBook-Pro-M1.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64\n```\n\n### Subsystem\n\nUtil\n\n### What steps will reproduce the bug?\n\n```js\nconst error = {\n // The error message itself is a getter that throws\n get message() { throw new Error('Oops'); }\n};\n\nconst thrower = {\n get foo() { throw error; }\n};\n\nutil.inspect(thrower, { getters: true });\n```\n\n### How often does it reproduce? Is there a required condition?\n\nEvery time.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nSimply return the object getter as `\"\u003cInspection threw\u003e\"` without the message that threw.\n\n### What do you see instead?\n\n```console\n$ node -e 'util.inspect({get foo() { throw{ get message() { throw new Error }} }}, { getters: true })'\nnode:internal/util/inspect:1435\n if (!isStackOverflowError(err)) throw err;\n ^\n\nError\n at get message ([eval]:1:56)\n at formatProperty (node:internal/util/inspect:2560:51)\n at formatRaw (node:internal/util/inspect:1428:9)\n at formatValue (node:internal/util/inspect:1183:10)\n at Object.inspect (node:internal/util/inspect:409:10)\n at [eval]:1:6\n at runScriptInThisContext (node:internal/vm:219:10)\n at node:internal/process/execution:451:12\n at [eval]-wrapper:6:24\n at runScriptInContext (node:internal/process/execution:449:60)\n\nNode.js v26.0.0-pre\n```\n\n### Additional information\n\nRelated to another issue 3 weeks ago:\n- https://github.com/nodejs/node/pull/60210\n- https://github.com/nodejs/node/pull/60139\n\nThis issue also highlights robustness concerns described in [OWASP 2025 (A10 – Mishandling of Exceptional Conditions)](https://owasp.org/Top10/2025/A10_2025-Mishandling_of_Exceptional_Conditions/):\n\n\u003e Catching and handling exceptional conditions ensures that the underlying infrastructure of our programs are not left to deal with unpredictable situations.\n\nNote that I did not encounter this problem in real-world objects; I discovered it by reading the Node.js source code while investigating behavior.\n","author":{"url":"https://github.com/yvele","@type":"Person","name":"yvele"},"datePublished":"2025-11-11T19:27:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/60683/node/issues/60683"}
| 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:d4690c97-0ee6-4f39-2797-347a2789fb28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CFA0:306DA5:47C08A:60FCE3:6A4C762F |
| html-safe-nonce | b33fa6a9c26673d136a679167fba2cd7503631b03a0b2af70f88f2e3876f2996 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkEwOjMwNkRBNTo0N0MwOEE6NjBGQ0UzOjZBNEM3NjJGIiwidmlzaXRvcl9pZCI6IjQwNDkxNzMxOTk5NzA5MjQwNzkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 861ba808ac55dc9731c16222e644c869dd3cddbfcb60d0c64ec9c673f0b23e1c |
| hovercard-subject-tag | issue:3613611640 |
| 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/60683/issue_layout |
| twitter:image | https://opengraph.githubassets.com/484122980a9ae7446f9b5f0f8f278c3e3a49b1c02907c1ef3885851045e77b2d/nodejs/node/issues/60683 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/484122980a9ae7446f9b5f0f8f278c3e3a49b1c02907c1ef3885851045e77b2d/nodejs/node/issues/60683 |
| og:image:alt | Version v20.19.5, v22.19.0, v24.8.0 Platform Darwin MacBook-Pro-M1.local 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:29 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6000 arm64 Subsyst... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yvele |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| 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 | 56ac743bebb13694b888673bb7257f4b97a4b7fd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width