René's URL Explorer Experiment


Title: deepStrictEqual rejects structurally equal array elements if a previous call contained a cycle and a previous array element is reference equal to the item in one of the arrays · Issue #62422 · nodejs/node · GitHub

Open Graph Title: deepStrictEqual rejects structurally equal array elements if a previous call contained a cycle and a previous array element is reference equal to the item in one of the arrays · Issue #62422 · nodejs/node

X Title: deepStrictEqual rejects structurally equal array elements if a previous call contained a cycle and a previous array element is reference equal to the item in one of the arrays · Issue #62422 · nodejs/node

Description: Version v25.8.1 Platform Linux codespaces-c0c7e6 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64 GNU/Linux Subsystem assert What steps will reproduce the bug? I have included a test which reproduces the bug in ...

Open Graph Description: Version v25.8.1 Platform Linux codespaces-c0c7e6 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64 GNU/Linux Subsystem assert What steps will reproduce the bug? I have incl...

X Description: Version v25.8.1 Platform Linux codespaces-c0c7e6 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64 GNU/Linux Subsystem assert What steps will reproduce the bug? I have incl...

Opengraph URL: https://github.com/nodejs/node/issues/62422

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"deepStrictEqual rejects structurally equal array elements if a previous call contained a cycle and a previous array element is reference equal to the item in one of the arrays","articleBody":"### Version\n\nv25.8.1\n\n### Platform\n\n```text\nLinux codespaces-c0c7e6 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec  3 15:13:22 UTC 2025 x86_64 GNU/Linux\n```\n\n### Subsystem\n\nassert\n\n### What steps will reproduce the bug?\n\nI have included a test which reproduces the bug in a draft PR in my fork: https://github.com/CraigMacomber/node/pull/1\n\n### How often does it reproduce? Is there a required condition?\n\nThis can only happen when cycle detection has been enabled due to some prior deep equality assert containing a cycle.\n\nIt also only happens when there are some reference equal values in the expected or actual structures which are reference equal in one but not the other.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nI expect deepStrictEqual to never throw when objects have the same structure but are not reference-equal.\n\nI expect deepStrictEqual's behaviour should not be impacted by previous calls to deepStrictEqual.\n\nI have these expectations since they seem like intuitive assumptions to infer based on the [current documentation for deepStrictEqual](https://nodejs.org/api/assert.html#assertdeepstrictequalactual-expected-message).\n\n### What do you see instead?\n\nBoth the above expectations are violated, see how the referenced test triggers a \"Values have same structure but are not reference-equal\" error from deepStrictEqual, but only if a previous call contained a cycle.\n\n### Additional information\n\nI was going to try and include a fix and not just a reproduction of the issue, but the lack of documentation and fine-grained testing of the functions in lib/internal/util/comparisons.js made me not have the confidence to attempt a fix.\n\nHere is a copy of the test from the linked PR so that thus bug is fully self-contained.\n\nNote that AI was used in the construction and documentation of this bug reproduction, but I manually confirmed it reproduces on current main ( 8e8b98d3aafa018f7b30cf7878bef057acf2d235 ), v24.14.0 and v25.8.1, and that it does not reproduce in v22.22.1.\nI also looked at the implementation of handleCycles in lib/internal/util/comparisons.js and confirmed that the explanation given for why this issue occurs is plausible, but I have not fully confirmed it to be accurate.\n\nThis issue is not blocking any of my work: I just happened to run into it once and took that opportunity to minimize a reproduction or it. I do not expect to be following up on this, and do not need it prioritized in any way. I simply hope that this bug report is useful to others to help improve the quality of Node.JS.\n\nFeel free to use my test/repro upstream as a regression test if this gets fixed.\n\n```javascript\n\n// Confirmed to fail in Node.JS v24.14.0 and v25.8.1\n// Regressed from v22.22.1 which works as expected.\n// \n// Node.js's `deepStrictEqual` (and `strict.deepEqual`) uses an internal\n// `detectCycles` function that starts with `memos = null` (no cycle\n// detection).  The first time a comparison throws during the null-memos\n// path — typically a stack overflow caused by comparing two circular\n// structures — `detectCycles` is permanently replaced by `innerDeepEqual`,\n// which passes a live `memos` object through every recursive call.\n//\n// In that memo-enabled mode the cycle-detection set (`memos.set`) is\n// seeded with the *current* val2 (`memos.d`) when it is first created.\n// That seed is never removed after the nested comparison returns, so when\n// the same expected object reference appears as val2 in a sibling\n// comparison, `set.add(sharedRef)` is a no-op.  The invariant\n// `originalSize === set.size - 2` then fails (only one new item was added\n// instead of two), and Node.js incorrectly concludes the structures are\n// not equal.\ntest(\"deepStrictEqual rejects structurally equal arrays when expected has a shared reference and cycle detection is active\", () =\u003e {\n  // `actual` has two *distinct* objects with identical content.\n  // `expected` reuses the *same* object reference at both positions.\n  const sharedExpected = { outer: { inner: 0 } };\n  const actualValues = [{ outer: { inner: 0 } }, { outer: { inner: 0 } }];\n  const expectedValues = [sharedExpected, sharedExpected];\n\n  // Works, but only if no cycles have been processed before running this test.\n  assert.deepStrictEqual(actualValues, expectedValues);\n\n  // Activate cycle-detection mode permanently in this process\n  // by comparing two isomorphic circular objects.\n  // The first attempt with null memos causes a stack overflow;\n  // the catch handler replaces detectCycles with innerDeepEqual for all future calls.\n  const circA = {};\n  circA.self = circA;\n  const circB = {};\n  circB.self = circB;\n  assert.deepStrictEqual(circA, circB); // triggers the permanent switch\n\n  // Individual element comparisons always pass …\n  assert.deepStrictEqual(actualValues[0], expectedValues[0]);\n  assert.deepStrictEqual(actualValues[1], expectedValues[1]);\n\n  // The combined comparison now fails because Node.js's\n  // cycle-detection set still contains `sharedExpected` from the first\n  // element's comparison when the second element is evaluated.\n  // Fails with:\n  // AssertionError [ERR_ASSERTION]: Values have same structure but are not reference-equal...\n  assert.deepStrictEqual(actualValues, expectedValues);\n});\n\n```","author":{"url":"https://github.com/CraigMacomber","@type":"Person","name":"CraigMacomber"},"datePublished":"2026-03-24T19:25:43.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/62422/node/issues/62422"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:0af31c09-9ba3-b28f-d17a-9cc1ed0b12d6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCE50:B5247:11D5F6F:182AF2B:6A4C75CC
html-safe-nonce8c222458241acf154a36b1090e692dc21a94a026cde3aa2a829e7456402b7fac
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRTUwOkI1MjQ3OjExRDVGNkY6MTgyQUYyQjo2QTRDNzVDQyIsInZpc2l0b3JfaWQiOiI3MjQwMjczNjUxMDk3Njk1NjkyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac31bf5e409626b6a980d52970cdc9947f39cd9f615a02e6553ff51fd931add18a
hovercard-subject-tagissue:4130164656
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/62422/issue_layout
twitter:imagehttps://opengraph.githubassets.com/85468a2d49221ebcc084500a91bd8acf84e9be6439a947c6b4dd6a0219d01a9d/nodejs/node/issues/62422
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/85468a2d49221ebcc084500a91bd8acf84e9be6439a947c6b4dd6a0219d01a9d/nodejs/node/issues/62422
og:image:altVersion v25.8.1 Platform Linux codespaces-c0c7e6 6.8.0-1044-azure #50~22.04.1-Ubuntu SMP Wed Dec 3 15:13:22 UTC 2025 x86_64 GNU/Linux Subsystem assert What steps will reproduce the bug? I have incl...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameCraigMacomber
hostnamegithub.com
expected-hostnamegithub.com
None3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release56ac743bebb13694b888673bb7257f4b97a4b7fd
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/62422#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62422
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62422
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/62422
Reloadhttps://github.com/nodejs/node/issues/62422
Reloadhttps://github.com/nodejs/node/issues/62422
Please reload this pagehttps://github.com/nodejs/node/issues/62422
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/62422
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 964 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Bughttps://github.com/nodejs/node/issues?q=type:"Bug"
#62509https://github.com/nodejs/node/pull/62509
deepStrictEqual rejects structurally equal array elements if a previous call contained a cycle and a previous array element is reference equal to the item in one of the arrayshttps://github.com/nodejs/node/issues/62422#top
#62509https://github.com/nodejs/node/pull/62509
assertIssues and PRs related to the assert subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22assert%22
https://github.com/CraigMacomber
CraigMacomberhttps://github.com/CraigMacomber
on Mar 24, 2026https://github.com/nodejs/node/issues/62422#issue-4130164656
CraigMacomber#1https://github.com/CraigMacomber/node/pull/1
current documentation for deepStrictEqualhttps://nodejs.org/api/assert.html#assertdeepstrictequalactual-expected-message
8e8b98dhttps://github.com/nodejs/node/commit/8e8b98d3aafa018f7b30cf7878bef057acf2d235
assertIssues and PRs related to the assert subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22assert%22
Bughttps://github.com/nodejs/node/issues?q=type:"Bug"
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.