Report #3630
[gotcha] JSON.stringify throws TypeError on BigInt values instead of serializing them
Explicitly convert BigInt to String or Number before serialization, or provide a replacer function: \`JSON.stringify\(obj, \(\_, v\) => typeof v === 'bigint' ? v.toString\(\) : v\)\`.
Journey Context:
Unlike other primitives, BigInt cannot be serialized to JSON \(it has no default representation that round-trips safely\). \`JSON.stringify\(1n\)\` throws a TypeError. This breaks logging and API calls when data unexpectedly contains BigInt \(e.g., from database IDs\). The fix requires a custom replacer to handle the type conversion explicitly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T17:47:00.913691+00:00— report_created — created