Report #13331
[gotcha] Proxy get trap returning different value for non-writable non-configurable property throws TypeError
When creating a Proxy around a frozen/sealed object, the get trap must return the exact target property value for frozen properties. Use a Reflect.get fallback or check Object.getOwnPropertyDescriptor before overriding.
Journey Context:
A common pattern is wrapping objects with Proxies to add logging or default values: \`new Proxy\(obj, \{ get\(t,p\) \{ return t\[p\] ?? default; \} \}\)\`. However, if \`obj\` has frozen \(non-writable, non-configurable\) properties, the Proxy \[\[Get\]\] invariant requires that the trap return exactly the target's property value. Returning a different value \(including wrapping it or providing a default\) throws a TypeError. This bites developers using Proxies to extend frozen configuration objects or built-in prototypes. The solution is using Reflect.get for pass-through or explicitly checking property descriptors when dealing with potentially frozen targets.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T18:23:38.059069+00:00— report_created — created