Title: `util.inspect` fails to represent a function returned from a getter · Issue #64838 · nodejs/node · GitHub
Open Graph Title: `util.inspect` fails to represent a function returned from a getter · Issue #64838 · nodejs/node
X Title: `util.inspect` fails to represent a function returned from a getter · Issue #64838 · nodejs/node
Description: 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 getStri...
Open Graph Description: 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? req...
X Description: 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? req...
Opengraph URL: https://github.com/nodejs/node/issues/64838
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`util.inspect` fails to represent a function returned from a getter","articleBody":"### Version\n\nv26.5.1\n\n### Platform\n\n```text\nLinux 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\n```\n\n### Subsystem\n\nutil\n\n### What steps will reproduce the bug?\n\n```js\nrequire('node:util').inspect(\n {\n get getString() {\n return 'foo';\n },\n string: 'foo',\n\n get getObject() {\n return { nested: true };\n },\n object: { nested: true },\n\n get getFunction() {\n return function fn() {};\n },\n function: function fn() {},\n },\n { getters: true },\n);\n```\n\n### How often does it reproduce? Is there a required condition?\n\nIt is perfectly reproducible.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nI expect functions to have similar rendering regardless of whether they come from a data property or a getter:\n```\n{\n getString: [Getter: 'foo'],\n string: 'foo',\n getObject: [Getter] { nested: true },\n object: { nested: true },\n getFunction: [Getter] [Function: fn],\n function: [Function: fn]\n}\n```\n\n### What do you see instead?\n\n```\n{\n getString: [Getter: 'foo'],\n string: 'foo',\n getObject: [Getter] { nested: true },\n object: { nested: true },\n getFunction: [Getter: \u003cInspection threw (TypeError: Symbol.prototype.toString requires that 'this' be a Symbol\n at fn.toString (\u003canonymous>)\n at formatPrimitive (node:internal/util/inspect:2272:13)\n at formatProperty (node:internal/util/inspect:2582:29)\n at formatRaw (node:internal/util/inspect:1448:9)\n at formatValue (node:internal/util/inspect:1195:19)\n at Object.inspect (node:internal/util/inspect:409:10)\n at [eval]:1:22\n at runScriptInThisContext (node:internal/vm:219:10)\n at node:internal/process/execution:483:12\n at [eval]-wrapper:6:24)>],\n function: [Function: fn]\n}\n```\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/gibson042","@type":"Person","name":"gibson042"},"datePublished":"2026-07-30T07:55:03Z","url":"https://github.com/nodejs/node/issues/64838"}
| 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:1a94e9e7-1581-8f63-b9be-48dfc6595c28 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF4A:3F64F:3564A2:4516BB:6AED1DEB |
| html-safe-nonce | 3f7312381efdd8758505d63b1e9835502e40753b478cf572aae17465f6d385b8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjRBOjNGNjRGOjM1NjRBMjo0NTE2QkI6NkFFRDFERUIiLCJ2aXNpdG9yX2lkIjoiNDkxNTIzMTA4MTUxOTQ1NTcyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3acc2d05c27f8c85c0400d6744b53919defc7d3e61dad7114fc3d8836a60a5f4 |
| hovercard-subject-tag | issue:5017545519 |
| 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/64838/issue_layout |
| twitter:image | https://opengraph.githubassets.com/277d1a5b56a5893c85b644504f3e9589106b0e12dedeb5d92925fe3cb1a7e0e7/nodejs/node/issues/64838 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/277d1a5b56a5893c85b644504f3e9589106b0e12dedeb5d92925fe3cb1a7e0e7/nodejs/node/issues/64838 |
| og:image:alt | 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? req... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gibson042 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6 |
| 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 | 707a24b346ac8a82878b9c084efaa38a997660cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width