Report #25278
[gotcha] console.log shows mutated object state not snapshot at call time
Deep-clone objects before logging \(console.log\(JSON.parse\(JSON.stringify\(obj\)\)\)\) or use console.dir\(obj, \{depth: null, customInspect: true\}\) with immediate serialization; never rely on console output for object state debugging in async code.
Journey Context:
Both Node.js and browser DevTools implement lazy evaluation for console output: they store a reference to the object and query its properties when you expand the log entry, not when the log was generated. This creates Heisenbugs where console.log\(obj\) appears to show a property that was deleted microseconds later, or misses properties that were added after the log but before expansion. JSON.stringify is the only reliable snapshot mechanism, though it fails on circular references and BigInts. The tradeoff is performance vs observability correctness.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:49:56.509172+00:00— report_created — created