Skip to content

[Bug]: Web UI crashes with React NotFoundError (removeChild) when a turn stops or completes with browser page translation enabled #40852

Closed

Description

@FinalVar

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Open the T3 Code Web UI (http://127.0.0.1:3773) in a browser (Chrome/Edge) and enable built-in full-page translation (e.g. English -> Chinese).
  2. Send a prompt in a thread so a turn enters the running/streaming state.
  3. Either click Stop while the turn is running, or wait for the turn to finish normally.

Expected behavior

Transitioning out of the running/streaming state (either via clicking Stop or when a turn finishes) should cleanly update the composer/status UI without crashing.

Actual behavior

The React error boundary triggers immediately with NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. whenever the turn is stopped or finishes while browser translation has wrapped/replaced text nodes in the active controls/status elements.

Reloading the app recovers the session (and the turn's stop/completion already happened on the server).

Impact

Major degradation or frequent failure

Version or commit

T3 Code (Beta) 0.1.11

Environment

Windows, Web UI (http://127.0.0.1:3773) with browser full-page translation enabled (English -> Chinese)

Logs or stack traces

T3 Code (Beta) 0.1.11
Path: /<environmentId>/<threadId>
Time: 2026-11-22T12:45:47.921Z

NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
    at Tu (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:107435)
    at Au (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:109027)
    at Mu (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:111653)
    at Au (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:109152)
    at Mu (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:111653)
    at Au (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:109152)
    at Mu (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:111653)
    at Au (http://127.0.0.1:3773/assets/dist-dAVDK5nE.js:34:109152)

Workaround

Disable full-page browser translation for 127.0.0.1 / localhost (or use selection/popup translation instead of DOM-mutating page translation). On the app side, wrapping bare dynamic text nodes in <span> or adding translate="no" / class="notranslate" to transient/interactive controls (e.g., Stop/Send button and running status indicators) would prevent React's removeChild from failing when page translation is active.

Activity

  1. FinalVar commented on Nov 22, 2026

    @FinalVar
    Author

    Additional reproduction detail observed in the same session:

    • While viewing Thread A when Thread A finishes: crashes once (recovering after clicking "Reload app").
    • While viewing Thread B when Thread A finishes in the background:
      1. It crashes immediately on Thread B (likely because the sidebar thread status indicator for Thread A updates/unmounts while translated).
      2. Clicking Reload app recovers Thread B.
      3. Switching from Thread B to Thread A triggers a second removeChild crash (presumably during thread route unmount / clearing Thread A's sidebar status/unread state under active translation), requiring another reload before Thread A stabilizes.

    This suggests the issue affects both the active thread composer/status controls and background thread status updates / route transitions in the sidebar when page translation is active.

  2. FinalVar commented on Nov 23, 2026

    @FinalVar
    Author

    Tested on v0.1.12-nightly.20261122.5098 (with #40856 / 620cf47) in Edge/Chrome with built-in page translation (English → Chinese) enabled.

    The NotFoundError crash is fixed, but pageTranslationGuard now causes duplicated/leaked translated text nodes in the sidebar thread rows that eventually squeeze out the thread title completely.

    Observed behavior

    In the sidebar under a project/folder (No project / 无项目), each turn transition leaks another translated label into the right-hand status/time slot:

    1. While a turn is running: the leaked previous labels stay inside the same <span> and inherit the blue running status color right before the spinner icon (完成 1 分钟 [spinner] 运行中):

      Running state inheriting blue color on leaked translated labels

    2. After that turn finishes: the spinner unmounts, and another translated label is appended (完成1 分钟完成刚刚):

      After turn finishes, accumulated translated labels

    3. After a few more turns: the accumulated text (完成刚刚完成刚刚完成刚刚完成1 分 — i.e. Completed + Just now repeated 3 times + Completed + 1m) overflows the row and crushes the thread title down to 0 width (completely hidden):

      Overflowed status slot crushing thread title completely

    Because the right-hand status slot has shrink-0 while the thread title on the left is min-w-0 flex-1 truncate, the leaked text grows horizontally until the title disappears.

    Root cause

    1. In apps/web/src/lib/pageTranslationGuard.ts, when Chrome/Edge replaces a React-owned Text node with <font><font>…</font></font>, child.parentNode !== this, so the patched removeChild silently returns without removing the translator-inserted <font> wrapper. On the next update, insertBefore falls back to appending (reference = null), leaving all previous <font> wrappers orphaned in the DOM.
      • This also happens in pageTranslationGuard.browser.test.tsx if running is toggled multiple times while translating newly inserted text nodes: each toggle leaves another orphaned <font> inside the <div>.
    2. In apps/web/src/components/sidebar/SidebarThreadRow.tsx (lines 1424–1444), the inFolder && topStatus branch ({topStatus.label}) and the <RelativeTimeLabel /> branch both render an unkeyed <span> containing bare text nodes. React reuses the exact same <span> DOM element across Running ↔ Completed ↔ Just now ↔ 1m transitions (which is also why the leaked 完成 1 分钟 turns blue alongside the spinner when switching into Running), leaking a new <font> wrapper on every transition.

    Possible fix

    • Give distinct keys to the mutually exclusive <span> branches in SidebarThreadRow.tsx (and wrap/key dynamic bare text nodes like {topStatus.label} and <RelativeTimeLabel /> in their own elements so React unmounts the intact <span> wrapper instead of a detached Text node).
    • Optionally, track/clean up translator-replaced <font> wrappers (or translate="no" on rapidly mutating status/time chrome) so guardDomAgainstPageTranslation doesn't leak orphaned <font> nodes across repeated re-renders in other dynamic slots as well.
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