facebook/react · warning

No element found with id "${id}"

Error message

No element found with id "${id}"

What it means

Store.getElementByID(id) looks up an element in the frontend Store's _idToElement map. When the id is unknown — typically because the element was unmounted and removed from the store, or the id came from a previous DevTools session/tree — it warns and returns null. It is the guarded sibling of _getElementByIDOrThrow, which throws for the same condition in code paths that assume validity.

Source

Thrown at packages/react-devtools-shared/src/devtools/store.js:707

          Error(
            `Could not find an element at index "${index}" because the Store tree weights are invalid.`,
          ),
        );
      }
    }

    return currentElement;
  }

  getElementIDAtIndex(index: number): number | null {
    const element = this.getElementAtIndex(index);
    return element === null ? null : element.id;
  }

  getElementByID(id: number): Element | null {
    const element = this._idToElement.get(id);
    if (element === undefined) {
      console.warn(`No element found with id "${id}"`);
      return null;
    }

    return element;
  }

  _getElementByIDOrThrow(id: Element['id']): Element {
    const element = this._idToElement.get(id);
    if (element === undefined) {
      return this._throwAndEmitError(
        Error(
          `Could not find element with id "${id}": no matching node was found in the Store.`,
        ),
      );
    }
    return element;
  }

View on GitHub (pinned to eafeac097b)

Solutions

  1. Prefer the check API: call store.containsElement(id) before getElementByID(id).
  2. Re-fetch the id from the current tree (e.g. getElementIDAtIndex) instead of caching it across renders.
  3. Treat a null return as 'element gone' and clear dependent UI state instead of retrying.

Example fix

// before
const element = store.getElementByID(id); // warns when gone

// after
const element = store.containsElement(id) ? store.getElementByID(id) : null;
Defensive patterns

Strategy: validation

Validate before calling

const element = store.containsElement(id)
  ? store.getElementByID(id)
  : null;

Prevention

When it happens

Trigger: Calling getElementByID with an id captured before a store mutation removed the element (unmount, filter change); replaying stored ids after a reload; selecting an element whose backend id is no longer projected into the store.

Common situations: DevTools UI code that holds a selected/inspected id across tree updates; extensions built on react-devtools-shared that cache element ids; inspecting short-lived components.

Related errors


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/0ead2578f4d31405. Report an issue: GitHub.