[Bug]: "Tailscale HTTPS" says "Start Tailscale" while Tailscale is running (CLI not on the app's PATH, macOS) #15919
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#
- macOS with the Tailscale app running and the Mac connected to the tailnet (
tailscale statusfrom the app's bundled CLI lists it). - Launch T3 Code from the Dock/Finder and open the desktop settings for the local environment.
- Look at the "Tailscale HTTPS" row.
Expected behavior#
The row detects Tailscale and offers HTTPS through Tailscale Serve / MagicDNS.
Actual behavior#
The row says "Start Tailscale to set up HTTPS access through MagicDNS." even though Tailscale is running. The "Tailscale IP" address is still listed under Network access, so only the HTTPS option is affected.
From the bundle, the server runs a bare tailscale status --json. The macOS Tailscale app keeps its CLI at /Applications/Tailscale.app/Contents/MacOS/Tailscale, and tailscale is not on the server's PATH, which for an app launched from the Dock is /usr/bin:/bin:/usr/sbin:/sbin. I believe that is why the lookup fails, but I did not capture the spawn error itself.
Suggestion: on macOS also try the app bundle path, and/or show "Tailscale CLI not found" instead of "Start Tailscale" when the spawn fails.
Impact#
Minor bug or inconvenience
Version or commit#
Desktop Alpha 0.0.45
Environment#
macOS (Darwin 25.6.0), Apple Silicon
juliusmarminge added labelsneeds more info
juliusmarminge removed labelsneeds more info
Another reproduction, with Zed. This one also shows the second half of the chain from this #28602 comment: the
.localfallback is built from the kernel hostname without validation. Here that hostname wasn't a valid DNS name at all.Setup
- Client: MacBook Pro running T3 Code (Nightly)
0.1.8-nightly.20261107.4327, macOS 27.0.1 (26A434) arm64, Zed 1.27.0 (Stable), Tailscale 1.102.4. - Server: Mac mini running T3 Code (Nightly) desktop
0.1.8-nightly.20261107.4327, macOS 27.0.1 (26A434) arm64, Tailscale 1.104.1. Tailscale was installed only asTailscale.app, with no CLI on PATH. Remote Login (sshd) was on. - The client connects to the server over Tailscale. Neither machine has an
~/.ssh/configentry for the other. - These versions are what's installed now. I didn't record the exact build at the time of the failure.
packages/tailscale/src/tailscale.tsandapps/server/src/environment/RemoteOpenTargets.tsare unchanged onmainat0080084c.
What happened
- On the Mac mini,
command -v tailscalefound nothing. The server's baretailscalecall failed, somagicDnsNamewas null and no MagicDNS target was listed. - The Mac mini's kernel hostname (
hostname) was9e:de:e4:xx:xx:xx, a MAC-address-shaped value that macOS can be left with.scutil --get LocalHostNamereturned the validJacks-Mac-mini-2the whole time. - The only target was therefore
9e:de:e4:xx:xx:xx.local. Open in Zed sentzed://ssh/<user>@9e%3Ade%3Ae4%3Axx%3Axx%3Axx.local/<path>. - Zed saved that host percent-encoded (
9e%3Ade…localin itsremote_connectionstable) and failed with "connecting to host timed out". Neither the encoded nor the decoded name resolves (dscacheutil -q host -a name …returns nothing).Jacks-Mac-mini-2.localdoes resolve on the same LAN.
What fixed it
- I put the CLI on PATH on the Mac mini:
/usr/local/bin/tailscaleis a shim that runsexec /Applications/Tailscale.app/Contents/MacOS/Tailscale "$@". With that PATH,tailscale status --jsonreports the MagicDNS name, so the server lists<host>.<tailnet>.ts.netfirst. - On the client, Open in Zed kept sending the bad
.localhost until I quit and reopened T3 Code (⌘Q). After that it sent the MagicDNS host, and Zed connected. I didn't test whether waiting or reconnecting without a restart would have been enough. - Separately, I reset the kernel hostname with
sudo scutil --set HostName jacks-mac-mini-2.
Suggestions (not tested as patches)
- Tailscale discovery: when PATH lookup fails on macOS, fall back to
/Applications/Tailscale.app/Contents/MacOS/Tailscale, run withTAILSCALE_BE_CLI=1as in #30756, so the app binary doesn't start its GUI. .localfallback: on macOS, usescutil --get LocalHostName, which is the actual Bonjour name, instead of the first label of the kernel hostname. Omit the target if the label isn't a valid hostname label (letters, digits and hyphens only). An unresolvable target sends users into a confusing SSH timeout, which is worse than showing no target.
Model and harness: this was diagnosed and drafted by Claude Opus 5.5 in Claude Code, running inside T3 Code. I reviewed it before posting. The diagnosis came from reading
RemoteOpenTargets.ts,tailscale.tsandremoteOpen.ts, plus the commands above on both machines. I didn't build or test a patch.- Client: MacBook Pro running T3 Code (Nightly)
tanstack-source added labelsbug
I tried to reproduce this on the current build and could not.
On origin/main 1e848876ee (Linux VM, so not the macOS settings row itself), I put a shim
tailscaleon PATH. Like the macOS Tailscale.app binary, it prints 'The Tailscale GUI failed to start…' to stdout and exits 0 unless TAILSCALE_BE_CLI/SHLVL/TERM/TERM_PROGRAM/PS1 is set; otherwise it prints status JSON. I ran the realreadTailscaleStatusfrom @t3tools/tailscale through the real Node ChildProcessSpawner with HostProcess.Platform=darwin. Withenv -i PATH=… HOME=…(Dock-like) it returned TailscaleStatusParseError. With TERM=xterm added it returned magicDnsName 'mac.tail.ts.net'. In apps/desktop/src/backend/tailscaleEndpointProvider.ts that error is swallowed byorElseSucceed(() => null), so no MagicDNS endpoint is advertised, and ConnectionsSettings.logic.tsmissingTailscaleEndpointDescriptionthen shows 'Start Tailscale to set up HTTPS access through MagicDNS.'. I did not see the UI row: that needs macOS with Tailscale.app. A commenter reproduced the binary's behaviour on real macOS (Tailscale 1.104.x, App Store and standalone builds). I pushed a failing unit test (darwin mock binary that answers based on the spawned command's env) to factory/repro-15919; it fails on main with TailscaleStatusParseError.Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.
juliusmarminge closed this
Sign in to join this conversation.
I hit this on current Nightly (
0.1.4-nightly.20261027.3796) and tracked down the root cause. It isn't (only) PATH: even when the app finds the CLI, the Tailscale binary runs in GUI mode because the Dock-launched app's env has noSHLVL/TERM.Repro (no T3 needed), simulating a Finder/Dock-launched process:
SHLVLset (any value, even0)TERMsetTAILSCALE_BE_CLIsetThis matches the mode check described in #21609 (ppid, then
TAILSCALE_BE_CLI/SHLVL/TERM/TERM_PROGRAM/PS1).What happens in T3:
DesktopShellEnvironmentcopies only an allowlist from the login shell (PATH, SSH_AUTH_SOCK, HOMEBREW_…), so with the Tailscale app dir on the login-shell PATH, the desktop does* find the binary, but spawns it withoutSHLVL/TERM.tailscale status --jsonexits 0 with that non-JSON text,parseTailscaleStatusfails, andorElseSucceed(() => null)turns it into "no Tailscale" with nothing logged.getAdvertisedEndpoints()then hastailscale-ip:but notailscale-magicdns:.So the bundle-path suggestion above wouldn't fix it on its own. I checked: spawning the absolute
.../MacOS/Tailscalepath fails the same way. Command name, path case, PATH lookup vs absolute path,detached, stdin, cwd and output size make no difference (288-run matrix across plain Node,ELECTRON_RUN_AS_NODE, Electron main, and Electron launched viaopen).Reproduces on both Tailscale variants:
io.tailscale.ipn.macos)io.tailscale.ipn.macsys)Workaround: a wrapper earlier on PATH than the app dir:
(A plain
shwrapper also works becauseshsetsSHLVL. A symlink does not: in CLI mode it aborts withBundleIdentifiers.swift:49: Fatal error: The current bundleIdentifier is unknown to the registry.)Suggested fix: add
TAILSCALE_BE_CLI=1withextendEnv: trueto every darwin tailscale spawn inpackages/tailscale(status, debug prefs, serve), and log a warning (e.g. taggedgui-mode) instead of silently returning null when the status can't be parsed. That also coverst3 servestarted by launchd. I have a small patch with tests that passesvp run check:changed. Happy to open a PR if you want one.Co-authored with Claude Opus 5.5 in Claude Code.