Skip to content

Crashes on Node 24 #93

@redbugz

Description

@redbugz

When upgrading to Node 24, if you console.log a VError, it crashes the process. Sample program:

const { VError } = require('verror')

const rootError = new Error('This is the root cause')
const err = new VError(rootError, 'This is a VError wrapping the previous error')

console.log('Print the VError:', err)

console.log('I finished running')

On Node 24:

❯ node errtest.js                                                                                                                                                                                                                 

node:internal/util/inspect:1183
    if (!isStackOverflowError(err)) throw err;
                                    ^

TypeError: Cannot read properties of undefined (reading 'value')
    at formatProperty (node:internal/util/inspect:2280:12)
    at formatRaw (node:internal/util/inspect:1176:9)
    at formatValue (node:internal/util/inspect:932:10)
    at inspect (node:internal/util/inspect:409:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2645:40)
    at formatWithOptions (node:internal/util/inspect:2507:10)
    at console.value (node:internal/console/constructor:360:14)
    at console.log (node:internal/console/constructor:416:61)
    at Object.<anonymous> (/Users/test/errtest.js:6:9)
    at Module._compile (node:internal/modules/cjs/loader:1761:14)

Node.js v24.12.0

On Node 22:

❯ node errtest.js                                                                                                                                                                                                                 

Print the VError: VError: This is a VError wrapping the previous error: This is the root cause
    at Object.<anonymous> (/Users/test/errtest.js:4:13)
    at Module._compile (node:internal/modules/cjs/loader:1730:14)
    at Object..js (node:internal/modules/cjs/loader:1895:10)
    at Module.load (node:internal/modules/cjs/loader:1465:32)
    at Function._load (node:internal/modules/cjs/loader:1282:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
    at node:internal/main/run_main_module:36:49 {
  jse_shortmsg: 'This is a VError wrapping the previous error',
  jse_cause: Error: This is the root cause
      at Object.<anonymous> (/Users/test/errtest.js:3:19)
      at Module._compile (node:internal/modules/cjs/loader:1730:14)
      at Object..js (node:internal/modules/cjs/loader:1895:10)
      at Module.load (node:internal/modules/cjs/loader:1465:32)
      at Function._load (node:internal/modules/cjs/loader:1282:12)
      at TracingChannel.traceSync (node:diagnostics_channel:322:14)
      at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
      at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
      at node:internal/main/run_main_module:36:49,
  jse_info: {},
  cause: [Function: ve_cause]
}
I finished running

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions