Title: assert: ERR_INVALID_ARG_TYPE on failing assert(value) under --enable-source-maps (v26 regression) · Issue #63169 · nodejs/node · GitHub
Open Graph Title: assert: ERR_INVALID_ARG_TYPE on failing assert(value) under --enable-source-maps (v26 regression) · Issue #63169 · nodejs/node
X Title: assert: ERR_INVALID_ARG_TYPE on failing assert(value) under --enable-source-maps (v26 regression) · Issue #63169 · nodejs/node
Description: Version v26.1.0 Platform Subsystem assert What steps will reproduce the bug? Save the following as repro.mjs: import { strict as assert } from 'node:assert'; try { assert(false); } catch (e) { console.log(e.constructor.name, e.code, JSON...
Open Graph Description: Version v26.1.0 Platform Subsystem assert What steps will reproduce the bug? Save the following as repro.mjs: import { strict as assert } from 'node:assert'; try { assert(false); } catch (e) { cons...
X Description: Version v26.1.0 Platform Subsystem assert What steps will reproduce the bug? Save the following as repro.mjs: import { strict as assert } from 'node:assert'; try { assert(false); } catch (e...
Opengraph URL: https://github.com/nodejs/node/issues/63169
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"assert: ERR_INVALID_ARG_TYPE on failing assert(value) under --enable-source-maps (v26 regression)","articleBody":"### Version\n\nv26.1.0\n\n### Platform\n\n```text\n\n```\n\n### Subsystem\n\nassert\n\n### What steps will reproduce the bug?\n\nSave the following as `repro.mjs`:\n\n```js\nimport { strict as assert } from 'node:assert';\n\ntry {\n assert(false);\n} catch (e) {\n console.log(e.constructor.name, e.code, JSON.stringify(e.message));\n}\n```\n\nRun it under Node.js v26.0.0 or later, with and without `--enable-source-maps`:\n\n```console\n$ node repro.mjs\nAssertionError ERR_ASSERTION \"The expression evaluated to a falsy value:\\n\\n assert(false)\\n\"\n\n$ node --enable-source-maps repro.mjs\nTypeError ERR_INVALID_ARG_TYPE \"The \\\"message\\\" argument must be one of type string or function. Received undefined\"\n```\n\nThe same `TypeError` is thrown for `assert.ok(false)` and `assert.strict(false)`. It does not appear for `assert.equal`, `assert.strictEqual`, and so on — only the auto-generated-message path used by `assert(value)` / `assert.ok(value)` is affected.\n\nThe same script on Node.js v25.9.0 (with `--enable-source-maps`) prints `AssertionError` as expected.\n\n\n### How often does it reproduce? Is there a required condition?\n\n100%. The required conditions are:\n\n1. Node.js v26.0.0 or v26.1.0\n2. `--enable-source-maps` is enabled.\n3. The script that performs the assertion has no source map registered for it.\n4. A failing `assert(value)` or `assert.ok(value)` is executed without an explicit `message` argument.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe same as Node.js v25.x: a failing `assert(value)` should throw an `AssertionError` instead of throwing a `TypeError`.\n\n### What do you see instead?\n\nA `TypeError [ERR_INVALID_ARG_TYPE]: The \"message\" argument must be one of type string or function. Received undefined` is thrown from inside `internal/assert/utils.js`, before any `AssertionError` is constructed:\n\n```\nTypeError [ERR_INVALID_ARG_TYPE]: The \"message\" argument must be one of type string or function. Received undefined\n at innerFail (node:internal/assert/utils:135:11)\n at innerOk (node:internal/assert/utils:169:5)\n at strict (node:assert:882:3)\n ...\n```\n\n\n### Additional information\n\nWhen `--enable-source-maps` is on but no source map is registered for the script (typical for a hand-written `.mjs` / `.cjs` file), `getErrorSourceLocation` in `lib/internal/errors/error_source.js` returns `undefined`, then `getErrMessage` in `lib/internal/assert/utils.js` returns `undefined`, then `innerOk` passes `[undefined]` to the new strict `innerFail`, and `innerFail` throws `ERR_INVALID_ARG_TYPE`.","author":{"url":"https://github.com/twada","@type":"Person","name":"twada"},"datePublished":"2026-05-07T13:56:36Z","url":"https://github.com/nodejs/node/issues/63169"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:b4849fa1-0963-2cee-f056-953743c3acf9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E15E:334404:8D1668:BBD7F5:6AED2AAA |
| html-safe-nonce | c5965ba0cad46bf7b43cce4a88f220b351dc7bd35b41f24c8e0ed7cc36284346 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTVFOjMzNDQwNDo4RDE2Njg6QkJEN0Y1OjZBRUQyQUFBIiwidmlzaXRvcl9pZCI6IjcwNjU4OTc0MjkxMzQ4MTM4NjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 8582db446b1af42cbc35cf777a223c19dab0cbd59753c257776963cf3067d765 |
| hovercard-subject-tag | issue:4399311398 |
| 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/63169/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4a0337230098a0c8043fef403412910bbe7ee9c826132e22ad7c2f8b21dd4537/nodejs/node/issues/63169 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4a0337230098a0c8043fef403412910bbe7ee9c826132e22ad7c2f8b21dd4537/nodejs/node/issues/63169 |
| og:image:alt | Version v26.1.0 Platform Subsystem assert What steps will reproduce the bug? Save the following as repro.mjs: import { strict as assert } from 'node:assert'; try { assert(false); } catch (e) { cons... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | twada |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9d95365dda0576efe9b71f45807595e396bd0ca9286fba5367a05048e6ddf8f2 |
| 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 | 98b41fa4b5635ceb45a4c54320fced73817ff290 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width