Title: `RangeError: Invalid string length` when logging a particular Error with `console.error` · Issue #64136 · nodejs/node · GitHub
Open Graph Title: `RangeError: Invalid string length` when logging a particular Error with `console.error` · Issue #64136 · nodejs/node
X Title: `RangeError: Invalid string length` when logging a particular Error with `console.error` · Issue #64136 · nodejs/node
Description: Version v26.3.1 Platform Darwin HQX-VGM7H2WVFG 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:41:06 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6030 arm64 arm Darwin Subsystem util What steps will reproduce the bug? npm install @...
Open Graph Description: Version v26.3.1 Platform Darwin HQX-VGM7H2WVFG 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:41:06 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6030 arm64 arm Darwin Subsystem util What ste...
X Description: Version v26.3.1 Platform Darwin HQX-VGM7H2WVFG 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:41:06 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6030 arm64 arm Darwin Subsystem util What ste...
Opengraph URL: https://github.com/nodejs/node/issues/64136
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`RangeError: Invalid string length` when logging a particular Error with `console.error`","articleBody":"### Version\n\nv26.3.1\n\n### Platform\n\n```text\nDarwin HQX-VGM7H2WVFG 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:41:06 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6030 arm64 arm Darwin\n```\n\n### Subsystem\n\nutil\n\n### What steps will reproduce the bug?\n\n1. `npm install @formatjs/icu-messageformat-parser@3.5.11`.\n2. Save this script:\n```javascript\ntry {\n require('@formatjs/icu-messageformat-parser').parse(\n `{0, plural, one {# ''אהבתי'''} two {# ''אהבתי'''} other {# ''אהבתי'''} }`,\n { requiresOtherClause: true, ignoreTag: true, shouldParseSkeletons: false },\n );\n} catch (err) {\n console.error(err);\n}\n```\n3. Run it. Observe error in the title:\n```\nλ node foo.js\nnode:internal/util/inspect:1885\n tempLine += ctx.stylize(nodeModule, 'module');\n ^\n\nRangeError: Invalid string length\n at markNodeModules (node:internal/util/inspect:1885:21)\n at formatError (node:internal/util/inspect:2019:18)\n at formatRaw (node:internal/util/inspect:1362:14)\n at formatValue (node:internal/util/inspect:1195:19)\n at inspect (node:internal/util/inspect:409:10)\n at formatWithOptionsInternal (node:internal/util/inspect:2917:40)\n at formatWithOptions (node:internal/util/inspect:2779:10)\n at console.value (node:internal/console/constructor:377:14)\n at console.error (node:internal/console/constructor:444:61)\n at Object.\u003canonymous\u003e (/Users/ikerins/web/foo.js:7:11)\n\nNode.js v26.3.1\n```\n\nI was not able to reduce the reproduction to not use the library, e.g. by manually constructing a SyntaxError with the same properties that it is producing: \nhttps://github.com/formatjs/formatjs/blob/2093ca683a08dd8ae0226085329e9811eca38791/packages/icu-messageformat-parser/index.ts#L49-L56\n\nI'm not sure why that doesn't work. Sorry.\n\n### How often does it reproduce? Is there a required condition?\n\nAlways reproduces with the above script. I could not narrow it down beyond that.\n\n### What is the expected behavior? Why is that the expected behavior?\n\n`console.error` does not throw.\n\n### What do you see instead?\n\n```\nλ node foo.js\nnode:internal/util/inspect:1885\n tempLine += ctx.stylize(nodeModule, 'module');\n ^\n\nRangeError: Invalid string length\n at markNodeModules (node:internal/util/inspect:1885:21)\n at formatError (node:internal/util/inspect:2019:18)\n at formatRaw (node:internal/util/inspect:1362:14)\n at formatValue (node:internal/util/inspect:1195:19)\n at inspect (node:internal/util/inspect:409:10)\n at formatWithOptionsInternal (node:internal/util/inspect:2917:40)\n at formatWithOptions (node:internal/util/inspect:2779:10)\n at console.value (node:internal/console/constructor:377:14)\n at console.error (node:internal/console/constructor:444:61)\n at Object.\u003canonymous\u003e (/Users/ikerins/web/foo.js:7:11)\n\nNode.js v26.3.1\n```\n\n### Additional information\n\nThe SyntaxError being logged _looks_ like this, but just constructing one with these properties directly does not reproduce, for reasons unknown. This:\n```\n console.log(err.message);\n console.log(err.stack);\n console.log(err.location);\n console.log(err.originalMessage);\n```\nProduces:\n```\nEXPECT_ARGUMENT_CLOSING_BRACE\nSyntaxError: EXPECT_ARGUMENT_CLOSING_BRACE\n at Module.parse (/Users/ikerins/web/node_modules/@formatjs/index.ts:50:19)\n at Object.\u003canonymous\u003e (/Users/ikerins/web/foo.js:2:49)\n at Module._compile (node:internal/modules/cjs/loader:1873:14)\n at Object..js (node:internal/modules/cjs/loader:2013:10)\n at Module.load (node:internal/modules/cjs/loader:1596:32)\n at Module._load (node:internal/modules/cjs/loader:1398:12)\n at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)\n at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)\n at node:internal/main/run_main_module:33:47\n{\n start: { offset: 57, line: 1, column: 58 },\n end: { offset: 73, line: 1, column: 74 }\n}\n{0, plural, one {# ''אהבתי'''} two {# ''אהבתי'''} other {# ''אהבתי'''} }\n```\n\nAlso, the offending `console.error` invocation hangs for a pretty long time before throwing. About 5-7s.","author":{"url":"https://github.com/isker","@type":"Person","name":"isker"},"datePublished":"2026-06-25T20:38:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/64136/node/issues/64136"}
| 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:f22b741b-33b4-db27-39c8-07195d8f5d81 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A75A:1E92:898833:C183A6:6A4F233B |
| html-safe-nonce | 26eb1fee621f56316324ae4d8e7d98003aba9cbc5802ec4f91c30afc0196609f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzVBOjFFOTI6ODk4ODMzOkMxODNBNjo2QTRGMjMzQiIsInZpc2l0b3JfaWQiOiI3NTk2MTAyNzY2NjI5NDMwMDc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c7a3498ab0bde38e61ff368f5b92b13eb4edab50bd9325f2d9f220033fd757bd |
| hovercard-subject-tag | issue:4747232127 |
| 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/64136/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2784e331e48b5e6807a66148fb3c502668207a11b2f1305dc730cd280cfd3fd9/nodejs/node/issues/64136 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2784e331e48b5e6807a66148fb3c502668207a11b2f1305dc730cd280cfd3fd9/nodejs/node/issues/64136 |
| og:image:alt | Version v26.3.1 Platform Darwin HQX-VGM7H2WVFG 25.5.0 Darwin Kernel Version 25.5.0: Mon Apr 27 20:41:06 PDT 2026; root:xnu-12377.121.6~2/RELEASE_ARM64_T6030 arm64 arm Darwin Subsystem util What ste... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | isker |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| 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 | 2b8f23afb982271f1b22258a94aede67a6b77760 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width