Skip to content

Desktop exits on launch in nightly 1700: dbus-next chunk re-requires main.cjs, registerSchemesAsPrivileged throws after ready #11720

Description

@goggi

What happened

The app is not launching after the latest update.

The Linux desktop app (Nightly AppImage) auto-updated from 0.0.41-nightly.20260914.1687 to 0.0.41-nightly.20260914.1700. Since then every launch exits with code 1 within about a second, before a window appears. Build 1687 still launches normally on the same machine with the same user data.

Diagnosis

The desktop main bundle main.cjs gets evaluated a second time after Electron is ready. The second evaluation runs program.pipe(Effect.provide(desktopRuntimeLayer), runMain) again. Its pre-ready layer (DesktopPreReadyPlatform.layer → ElectronProtocol.layerSchemePrivileges) calls protocol.registerSchemesAsPrivileged, which throws after ready. That second runMain then exits the process with code 1.

Chain, taken from the packaged 1700 app.asar and a NODE_DEBUG=module launch:

  1. During bootstrap, SnapShot runs in portal capture mode (Wayland/Hyprland here) and lazily loads ./PortalCaptureShortcut-*.cjs.
  2. That chunk requires ./dbus-next-*.cjs at top level.
  3. dbus-next-*.cjs does const require_main = require("./main.cjs") at top level, to get the bundled sax (require_main.require_sax()).
  4. Module._load checking cache for …/dist-electron/main.cjs false: the entry, which was loaded as module ".", is not a cache hit, so the whole entry bundle runs again. It shares the same Schema-*.cjs chunk, which is why the error comes from fiber #160.
  5. ERROR (#160): Error: protocol.registerSchemesAsPrivileged should be called before app is ready, and the process exits with code 1. The first runtime's logs keep going for a few ms, up to bootstrap backend start requested, then the process dies.

Likely regression: #11410 (683aa870 build(desktop): bundle the main process and stage only its native externals). It inlines dbus-next, sax, effect, and others into the desktop bundle. app.asar/node_modules went from 136 entries in 1687 to 13 in 1700, and the bundler now hoists sax into the entry chunk, so a lazy chunk re-requires the entry. In 1687, dbus-next was an external package in node_modules, and startup does not fail. Nightly 1700 = 01e05c15268d = main at the time of triage, so no fix is available yet.

This probably affects any Linux desktop where SnapShot uses portal capture mode. The trigger is the mode === "portal" branch that lazily loads PortalCaptureShortcut.

Steps to reproduce

  1. On Linux Wayland (Hyprland 0.56.2 here), with SnapShot using portal capture mode, install/update to T3 Code Nightly 0.0.41-nightly.20260914.1700.
  2. Launch the app from a terminal.
  3. Observe the registerSchemesAsPrivileged error and exit code 1; no window appears.
  4. Optional: launch with NODE_DEBUG=module and observe dbus-next-*.cjs requesting ./main.cjs and missing the cache.

Deterministic: 3/3 launches failed.

Version

0.0.41-nightly.20260914.1700 (t3codeCommitHash 01e05c1); last working 0.0.41-nightly.20260914.1687 (c07575f)

Environment

Arch Linux x64 (kernel 7.2.3-arch1-3), Hyprland 0.56.2 on Wayland; Nightly AppImage run from a persistent --appimage-extract directory with --no-sandbox

Evidence

[11:21:55.913] INFO (#3): app ready
[11:21:55.937] INFO (#3): bootstrap start
[11:21:55.949] INFO (#3): bootstrap ipc handlers registered
MODULE: Module._load REQUEST ./PortalCaptureShortcut-i8VbHw7e.cjs parent: .
MODULE: Module._load REQUEST ./dbus-next-DDJh0A1P.cjs parent: …/dist-electron/PortalCaptureShortcut-i8VbHw7e.cjs
MODULE: Module._load REQUEST ./main.cjs parent: …/dist-electron/dbus-next-DDJh0A1P.cjs
MODULE: Module._load checking cache for …/resources/app.asar/apps/desktop/dist-electron/main.cjs false
MODULE: load "…/resources/app.asar/apps/desktop/dist-electron/main.cjs" for module "…/dist-electron/dbus-next-DDJh0A1P.cjs"
[11:21:55.988] ERROR (#160): Error: protocol.registerSchemesAsPrivileged should be called before app is ready
    at desktop.electron.protocol.registerSchemePrivileges (…/resources/app.asar/apps/desktop/dist-electron/main.cjs:34390:118)
[11:21:56.003] INFO (#3): bootstrap backend start requested
# process exits with code 1

# dist-electron/dbus-next-DDJh0A1P.cjs (1700)
const require_rolldown_runtime = require("./rolldown-runtime-fg3euq-1.cjs");
const require_main = require("./main.cjs");
...
sax = require_main.require_sax();

Related issues

#11710 and #11523 are other bugs in the 0.0.41 nightlies (static asset serving from app.asar), not startup exits. #10911 is an intermittent silent exit on Hyprland in 0.0.38; this one is deterministic, has a clear error, and started with nightly 1700.

Fix applied or workaround

Launched the still-extracted previous build (1687) directly, which starts normally (backend ready, main window created). No source changes. Downgrading to stable was avoided because of possible database migrations.

Filed by

Claude Code (Claude Opus 5, claude-opus-5[1m]) via t3 triage

Activity

  1. juliusmarminge commented on Sep 14, 2026

    @juliusmarminge
    Member

    Triage

    Accepted as a critical Linux desktop launch-blocker. Nightly 0.0.41-nightly.20260914.1700 (01e05c152) exits with code 1 before a window appears. 0.0.41-nightly.20260914.1687 (c07575f573dd) still starts on the same machine and profile.

    This is not a duplicate of #10911 (intermittent Hyprland silent exit in 0.0.38, no registerSchemesAsPrivileged error). It is also not #11710 (asar fs.open → HTTP 500) or #11523 (t3code:// truncated assets). Those fail after the process is up.

    The filed NODE_DEBUG=module chain matches current main:

    1. SnapShot bootstrap on Wayland (captureMode("linux") → "portal") lazily loads PortalCaptureShortcut (Hyprland) or NiriCaptureShortcut (Niri).
    2. That chunk requires bundled dbus-next.
    3. The dbus-next chunk does require("./main.cjs") to reach sax, which the bundler hoisted into the entry.
    4. Node’s cache misses: the entry was loaded as ".", not ./main.cjs.
    5. A second DesktopApp.program.pipe(..., runMain) runs DesktopPreReadyPlatform.layer → ElectronProtocol.layerSchemePrivileges after ready and throws. runMain exits 1.
    Error: protocol.registerSchemesAsPrivileged should be called before app is ready
    

    What the code does

    #11410 (683aa870) is in 1700 and not in 1687. It inlines the main-process tree (apps/desktop/vite.config.ts + scripts/lib/desktop-external-packages.ts) and leaves only native/Playwright packages on disk. dbus-next (and sax) used to be real node_modules in 1687; they are now inside dist-electron/*.cjs.

    apps/desktop/src/main.ts evaluates runMain at module top level. registerSchemesAsPrivileged is documented as pre-ready-only (apps/desktop/src/electron/ElectronProtocol.ts). linuxCaptureSession.ts already keeps dbus-next off the eager path; the lazy CJS chunk graph now points back at the entry.

    Same re-require is waiting on any post-ready await import of LinuxSnapShot.ts / GnomeCaptureSetup.ts (DesktopSnapShot.state / setup). Blast radius is Linux Wayland portal sessions, not only Hyprland.

    No open fix PR. Current HEAD is still 01e05c152.

    Next step

    1. Stop lazy CJS chunks from require("./main.cjs"). Prefer a bundler fix (inlineDynamicImports, keep sax in the dbus-next chunk, or disable main-process code-splitting). Putting dbus-next back on DESKTOP_RUNTIME_EXTERNAL_PREFIXES is a valid 1687-shaped hotfix, not the long-term policy.
    2. Do not “fix” this by ignoring registerSchemesAsPrivileged after ready. A second runMain would still start a second desktop program.
    3. Add a packaging/bundle assertion: no dist-electron/*.cjs chunk may require("./main.cjs"). Optionally guard main.ts so a cache-miss re-entry is a no-op.
    4. Smoke the packaged Linux AppImage on Wayland (Hyprland and at least one of GNOME/Niri) through bootstrap backend start requested and first SnapShot state read.

    Workaround: extracted Nightly 1687. Avoid jumping to stable if this profile already ran 0.0.41 migrations.

  2. AntoineArt commented on Sep 14, 2026

    @AntoineArt

    Also hit this on Arch/Omarchy + Hyprland (Wayland), nightly 1700 → exits on launch, same registerSchemesAsPrivileged should be called before app is ready error, deterministic.

    Extra symptom: when the main process exits, the AppImage FUSE mount is torn down while the bundled server (apps/server/dist/bin.mjs --bootstrap-fd 3) and SnapShotAccessibilityWorker.cjs are still running, so both die with SIGBUS (BUS_ADRERR) and leave systemd-coredump cores — can look like a native crash but is just a side effect.

    Workaround: downgrading to 0.0.41-nightly.20260911.1551 launches fine.

  3. added
    bugSomething is broken or behaving incorrectly.
    acceptedfeature request accepted
    via-triageFiled through npx t3 triage
    on Sep 14, 2026
  4. alex73630 commented on Sep 14, 2026

    @alex73630

    Same error here, also running Arch and Hyprland (0.56.2), build 1687 is working fine but not 1700

  5. Bombatomica64 commented on Sep 14, 2026

    @Bombatomica64
    Contributor

    also hit on debian with hyprland 0.56.2 build 1700

  6. goggi commented on Sep 14, 2026

    @goggi
    Author

    Still reproduces on nightly 0.0.41-nightly.20260914.1707 (9375c779707f), which is current main.

    Workaround still works: launch the extracted 1687 build directly.

    Posted by Claude Code (Claude Opus 5, claude-opus-5[1m]) via t3 triage.

  7. xsqu1znt commented on Sep 14, 2026

    @xsqu1znt

    Also reproduces on Fedora Linux 44 Workstation, GNOME Shell 50.4, Wayland.

    T3 Code version: 0.0.41-nightly.20260914.1722
    AppImage SHA-256: acf4467e4910eafbebfa7503f5a5ce05126b4ffcdbaa7a9959f3adce9314dc35

    Launch reaches "bootstrap backend start requested", then logs:
    Error: protocol.registerSchemesAsPrivileged should be called before app is ready

    The main process exits before a window appears. The orphaned server and
    SnapShotAccessibilityWorker then crash with SIGBUS after the AppImage mount
    is removed.

  8. squispeb commented on Sep 15, 2026

    @squispeb

    Additional reproduction from Arch Linux x86_64, installed as the t3code-nightly-bin AUR package via yay:

    • 0.0.41_nightly.20260914.1722-1: fails at launch.
    • 0.0.41-nightly.20260915.1735-1 (b5b29e7): fails at launch.
    • 0.0.41_nightly.20260914.1687-1: last known good; launches normally.

    Environment: Arch Linux, kernel 7.2.3-arch1-3, x86_64, Wayland session. The installed 1735 package reports Architecture: x86_64 and is installed as t3code-nightly-bin.

    Exact reproduction:

    pacman -Q t3code-nightly-bin
    ls -l /opt/t3code-nightly-bin/t3code
    timeout 20 /usr/bin/t3code-nightly --no-sandbox > /tmp/t3code-nightly.log 2>&1
    echo $?

    The 1735 run exits with code 1 before a window appears. The relevant log excerpt is:

    ERROR (#158): Error: protocol.registerSchemesAsPrivileged should be called before app is ready
        at desktop.electron.protocol.registerSchemePrivileges (/opt/t3code-nightly-bin/resources/app.asar/apps/desktop/dist-electron/main.cjs:35862:118)
    INFO (#3): selected backend port via sequential scan
      port: 3775
      startPort: 3773
    INFO (#3): bootstrap resolved backend endpoint
      baseUrl: http://127.0.0.1:3775/
    

    The same exit code reproduces with --no-sandbox --disable-gpu and --no-sandbox --ozone-platform=x11. The --disable-gpu run also ends with write EPIPE from apps/desktop/dist-electron/snapShot/SnapShotAccessibilityWorker.cjs (readAccessibility, target.send), consistent with the main-process exit.

    The profile is clean enough to rule out basic state corruption: ~/.config/t3code/Preferences and Local State parse as valid JSON, declarative_performance_observer.db returns PRAGMA integrity_check = ok, and there is no ~/.config/t3code/SingletonLock. Existing backend listeners on 127.0.0.1:3773 and 127.0.0.1:3774 answer HTTP requests; 3775 is not listening/reachable.

    This still points at the main-process bundling change in 683aa870 (first present in the .1700 nightly): a lazy CJS chunk re-requiring ./main.cjs can re-enter top-level runMain after Electron is ready, producing the registerSchemesAsPrivileged failure. The 1687 build predates that change and remains the working rollback.

  9. ImBIOS commented on Sep 15, 2026

    @ImBIOS

    Additional repro from Ubuntu 26.04 (GNOME Shell, Wayland session, x64):

    • 0.0.41-nightly.20260915.1735 AppImage: exits with code 1 before any window appears. Log shows ERROR (#160): Error: protocol.registerSchemesAsPrivileged should be called before app is ready at dist-electron/main.cjs:35862, dying right after bootstrap backend start requested. Deterministic across runs, including with a fresh database.
    • 0.0.41-nightly.20260914.1687 on the same machine and profile: backend ready + main window created, runs fine.

    So this also hits GNOME, not just Hyprland/Niri — consistent with the portal-capture-mode trigger. 1735 still contains require("./main.cjs") in the dbus-next chunk (verified via strings on the shipped app.asar).

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

    acceptedfeature request acceptedbugSomething is broken or behaving incorrectly.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions