Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Preview tabs sometimes log "sandboxed_renderer.bundle.js script failed to run" (Electron #54149, fixed in 44.4.4) #13990

ClosedVantrongs(GitHub profile, opens in a new tab) opened this issue 1 comment

Before submitting

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

Area

apps/desktop

Steps to reproduce

  1. Open a new preview tab on any page, for example https://example.com, through preview automation (preview_open).
  2. Read the console with preview_snapshot.
  3. Repeat with new tabs; the errors appear on some of them.

Expected behavior

consoleEntries holds only the page's own messages.

Actual behavior

Some new tabs log the two errors below, and preview_snapshot returns them in consoleEntries. The page itself loads and works. For agents this is noise: an agent checking a page reads consoleEntries and has to work out that these errors are not the page's, which is misleading when the task is to find console errors.

Cause and fix

The errors come from Electron, not from the page: electron/electron#54149. When a DevTools protocol client attaches to a sandboxed frame before its first navigation finishes, the sandbox bundle runs on the initial empty document, which has no startupData. Preview automation is such a client, so the race depends on timing.

Fixed upstream in electron/electron#54155 and released in v44.4.4 ("Fixed a spurious sandboxed_renderer.bundle.js script failed to run console error when DevTools attached to a sandboxed frame before its first navigation"); backports are in v43.7.4 and v42.11.7. Bumping Electron to 44.4.5, the latest 44.x patch, should remove the errors.

Impact

Cosmetic issue

Version or commit

main @ de251fc (electron: 44.4.2 in apps/desktop/package.json); installed 0.0.43-nightly.20260926.2282

Environment

Desktop app on Linux (NixOS, Wayland, niri), Electron 44.4.2

Logs or stack traces

Electron sandboxed_renderer.bundle.js script failed to run
TypeError: Cannot destructure property 'preloadScripts' of 'binding.startupData' as it is null.
    at node:electron/js2c/sandbox_bundle:2:124925
    at ___electron_webpack_init__ (node:electron/js2c/sandbox_bundle:2:125864)

Screenshots, recordings, or supporting files

No response

Workaround

Ignore these two console entries.

  1. Vantrongs(GitHub profile, opens in a new tab) added labelsneeds-triage

  2. Triage

    Confirmed on de251fc. This is Electron's sandboxed-renderer race (electron/electron#54149), and preview automation is a client that hits it. No duplicate in this repo.

    Preview guests are sandboxed (sandbox=true in PREVIEW_WEBVIEW_PREFERENCES). On attach, registerWebview starts a control session that calls webContents.debugger.attach("1.3") and Runtime.enable (PreviewManager.ensureControlSession in apps/desktop/src/preview/Manager.ts). That can land on the guest's initial empty document before the first navigation commits. Electron 44.4.2 then runs sandboxed_renderer.bundle.js with binding.startupData === null and logs the two lines in the report. The committed document still receives startup data, so the page loads and works. The same debugger session records those lines (Log.entryAdded / Runtime.exceptionThrown), and preview_snapshot returns them in consoleEntries. It only shows up on some tabs because it depends on attach-versus-commit timing.

    A guest's main frame is in scope: ShouldLoadPreload does not treat it as a webview frame (IsWebViewFrame is false for main frames), even though the upstream report was written against extension background pages.

    Fixed upstream in electron/electron#54155 and released in Electron 44.4.4. 44.4.5 is the latest 44.x and keeps the same Chromium 152.0.7977.130, Node 24.21.0, and V8 15.2.124.28 as 44.4.2. Electron 45 is still alpha. Desktop is pinned at electron@44.4.2 in apps/desktop/package.json (also listed under minimumReleaseAgeExclude in pnpm-workspace.yaml). No app change is needed.

    Until that bump ships, ignore those two node:electron/js2c/sandbox_bundle entries.

  3. juliusmarminge removed labelsneeds-triage

  4. juliusmarminge added labelsupstream

  5. juliusmarminge added labelsvia-triage

  6. juliusmarminge closed this

Sign in to join this conversation.