Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- On NixOS with
programs.nix-ld.enable = trueand its default library set, let T3 install its preview browser (callhtml_previewfrom any thread). html_previewfails with "This host is missing libraries T3's browser needs (libglib-2.0.so.0, libgobject-2.0.so.0, libnspr4.so, … 22 in all). Runsudo t3 browser setupon the host to install them, then try again."sudo t3 browser setupfinds no apt-get and prints "Install them with your package manager, then run this again."- Give nix-ld the libraries (list under Workaround) and switch.
html_previewandhtml_rendernow work. - Run
t3 browser setupagain. It still lists all 22 libraries as missing.
Expected behavior
The library check agrees with what the loader finds when the browser starts, so once the libraries are there, neither T3 nor t3 browser setup reports them missing.
Actual behavior
PreviewBrowserHost.missingLibraries runs ldd <chrome-headless-shell>. On NixOS, ldd runs the glibc loader from the Nix store, and that loader doesn't read nix-ld's library path. The browser itself starts through /lib64/ld-linux-x86-64.so.2, which is nix-ld and does read it. So ldd reports all 22 libraries as not found whether or not nix-ld provides them:
$ NIX_LD_LIBRARY_PATH=<set with the libraries> chrome-headless-shell --version
Google Chrome for Testing 154.0.8037.92
$ NIX_LD_LIBRARY_PATH=<same set> ldd chrome-headless-shell | grep -c 'not found'
22
What follows from that:
t3 browser setupnever reports a NixOS host as ready.- When the browser fails for some other reason on such a host,
diagnoseLaunchFailurestill blames missing libraries and points atsudo t3 browser setup, which hides the real cause. t3 browser setupcan only install libraries with apt-get (DEBIAN_PACKAGES).
A check that trusts the loader would avoid this. For example, report missing libraries only when Chrome's own stderr has the loader's error while loading shared libraries: line (glibc prints it on every distro, nix-ld included). In t3 browser setup, start the browser with --version before listing libraries.
Related: on NixOS this missing-libraries exit is also what triggered the server crash in #16794 for us (the fix is #16555).
Impact
Minor bug or occasional failure
Version or commit
nightly 0.0.46-nightly.20261007.2761 (PreviewBrowserHost.ts is unchanged on main @ 611132c)
Environment
NixOS 26.11 x86_64, nix-ld 2.0.6, T3 executable (Node 26.8.2), Chrome for Testing headless shell 154.0.8037.92
Workaround
Give nix-ld the libraries the headless shell links (nixpkgs attribute names):
programs.nix-ld.libraries = with pkgs; [
alsa-lib at-spi2-core dbus expat glib libgbm libx11 libxcb libxcomposite libxdamage
libxext libxfixes libxkbcommon libxrandr nspr nss systemd
];at-spi2-core provides libatk, libatk-bridge and libatspi, and systemd provides libudev. After a switch, the browser picks them up the next time it starts. t3 browser setup keeps listing them, as described above.
Found and written with Claude Opus 5.5 in T3 Code (OpenCode 2 + cursor-opencode-provider).
Activity
juliusmarminge commentedon Oct 7, 2026
Note
Grok responding on behalf of Julius.
Thanks @nkoynov, the code matches your report. Checked against
main@ 611132c.Root cause. All of the library detection comes from
lddoutput:missingLibrariesrunsldd <executable>with stderr ignored, and counts every<lib> => not foundline (apps/server/src/preview/PreviewBrowserHost.ts:92,:118-129). It never launches the browser.t3 browser setupreports ready only when that list is empty (apps/server/src/cli/browser.ts:121-131). It doesn't check whether the browser actually starts. With your 22 false positives it never reaches "ready". As root with apt it would also runapt-get installfor nothing (:173-185).diagnoseLaunchFailurechecks the sandbox signature first. On Linux it then blames whateverlddlists, so any unrelated launch failure gets reported asPreviewBrowserLibrariesError(PreviewBrowserHost.ts:99-115).apt-getwithDEBIAN_PACKAGES(PreviewBrowserHost.ts:52,browser.ts:173-185). Without/usr/bin/apt-get(browser.ts:124), setup prints "Install them with your package manager, then run this again" and exits (:166-170). On NixOS that loops forever, becauselddkeeps reporting the same libraries.I couldn't reproduce the NixOS
lddvs nix-ld loader difference here. The--versionvslddcomparison in your report is the evidence for it.Fix. Trust the real loader over
ldd:<executable> --versionfirst. If it exits 0, the libraries are fine: skip the library step and report ready.diagnoseLaunchFailure, returnPreviewBrowserLibrariesErroronly when the launch output contains glibc'serror while loading shared libraries:line. Take the library names from that line, or fall back tolddonly after that signature shows up.Related: #16794 / #16555 (same setup flow), and open #16872 (reporting how the html preview browser exited) would pair well with step 2.
Workaround (from the reporter). Add the headless shell's libraries to
programs.nix-ld.libraries(the nixpkgs list in the issue body) and switch.html_previewandhtml_renderthen work, even thought3 browser setupstill won't say ready until this is fixed.