Version
v26.5.1
Platform
Linux dt2 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:53:05 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
util
What steps will reproduce the bug?
require('node:util').inspect(
{
get getString() {
return 'foo';
},
string: 'foo',
get getObject() {
return { nested: true };
},
object: { nested: true },
get getFunction() {
return function fn() {};
},
function: function fn() {},
},
{ getters: true },
);
How often does it reproduce? Is there a required condition?
It is perfectly reproducible.
What is the expected behavior? Why is that the expected behavior?
I expect functions to have similar rendering regardless of whether they come from a data property or a getter:
{
getString: [Getter: 'foo'],
string: 'foo',
getObject: [Getter] { nested: true },
object: { nested: true },
getFunction: [Getter] [Function: fn],
function: [Function: fn]
}
What do you see instead?
{
getString: [Getter: 'foo'],
string: 'foo',
getObject: [Getter] { nested: true },
object: { nested: true },
getFunction: [Getter: <Inspection threw (TypeError: Symbol.prototype.toString requires that 'this' be a Symbol
at fn.toString (<anonymous>)
at formatPrimitive (node:internal/util/inspect:2272:13)
at formatProperty (node:internal/util/inspect:2582:29)
at formatRaw (node:internal/util/inspect:1448:9)
at formatValue (node:internal/util/inspect:1195:19)
at Object.inspect (node:internal/util/inspect:409:10)
at [eval]:1:22
at runScriptInThisContext (node:internal/vm:219:10)
at node:internal/process/execution:483:12
at [eval]-wrapper:6:24)>],
function: [Function: fn]
}
Additional information
No response
Version
v26.5.1
Platform
Subsystem
util
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
It is perfectly reproducible.
What is the expected behavior? Why is that the expected behavior?
I expect functions to have similar rendering regardless of whether they come from a data property or a getter:
What do you see instead?
Additional information
No response