Skip to content

Bug: use() crashes in DEV with TypeError: Cannot add property _debugInfo when the thenable is frozen/non-extensible #37795

Closed

Description

@zhoubiao188

React version: main @ b618bbb (and 19.2.0, where the underlying code first ships in an OSS release via #37772)

Steps To Reproduce

Pass a non-extensible thenable whose status was already set by a userspace implementation to use() in a development build:

// e.g. a Suspense-compatible library that pre-instrumented its promise,
// and a cache that freezes entries before sharing them
const thenable = Promise.resolve('Hi');
thenable.status = 'fulfilled';
thenable.value = 'Hi';
Object.freeze(thenable);

function Child() {
  return <Text text={use(thenable)} />;
}

Link to code example: minimal repro above (also added as a regression test in the linked PR)

The current behavior

The render crashes with a TypeError thrown from React internals:

TypeError: Cannot add property _debugInfo, object is not extensible
    at trackUsedThenable (react-dom/cjs/react-dom-client.development.js:…)

The error points into React, not at any user code, and takes down the whole render in DEV. In production the same code works fine, so the failure mode is DEV/PROD divergence.

The expected behavior

Debug-info instrumentation should never crash a user's render. When the thenable doesn't allow new properties, React should skip attaching the inferred _debugInfo (debug info is simply dropped for that thenable) and use() should unwrap the value normally — matching the existing guard in addAsyncInfo (ReactFlightClient.js), which already skips _debugInfo for frozen values with a "Debug info is dropped for frozen elements" comment.

Analysis

trackUsedThenable (packages/react-reconciler/src/ReactFiberThenable.js) does, in DEV:

if (__DEV__ && thenable._debugInfo === undefined) {
  ...
  thenable._debugInfo = [{awaited: ioInfo}]; // throws on frozen/sealed/non-extensible

Two notes on scope:

  1. This is a regression for OSS builds: the enableAsyncDebugInfo flag was landed in [flags] clean up enableAsyncDebugInfo #37772 (2026-10-07), so this code path now runs for every use(thenable) call in DEV. Before that commit, an instrumented frozen thenable took the case 'fulfilled' / 'rejected' / typeof status === 'string' paths and worked fine.
  2. A non-instrumented frozen promise (use(Object.freeze(promise))) already crashed before this change at the pendingThenable.status = 'pending' assignment in the default branch — that's a separate, pre-existing issue (React can't attach its status expando either, and would need a WeakMap-based fallback). This report is only about the debug-info expando, which is purely for instrumentation and can always be skipped safely.

Happy to send a PR that skips the debug-info inference when Object.isExtensible(thenable) is false, with a regression test.

Activity

  1. added a commit that references this issue on Oct 12, 2026
    259980d
  2. added 2 commits that reference this issue on Oct 12, 2026
    332d719
    e2d4c4e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions