[Bug]: Tailscale Serve failures are only logged as a warning; the server silently stays loopback-only #16238
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 Linux, as a user who is not the Tailscale operator (or on a tailnet with HTTPS certificates disabled), run
t3 serve --tailscale-serve. - Watch the output and try to reach the server from another tailnet device.
Expected behavior#
When Tailscale Serve was requested and fails, the failure is visible: an error with the reason and a remedy (for example "not the Tailscale operator: run sudo tailscale set --operator=$USER"), surfaced in the CLI output, t3 service status and Settings → Connections, ideally with retry.
Actual behavior#
The server starts normally, listens on 127.0.0.1 only, and is unreachable from the tailnet. The only trace is a log warning; there is no retry and no user-visible signal.
From the 0.0.45 bundle: src/server.ts wraps ensureTailscaleServe(...) in catch_(cause => logWarning("Failed to configure Tailscale Serve", ...)).pipe(as(null)). By contrast, t3 pair --tailscale fails loudly in the same situation (TailscaleServeFailedError).
Impact#
Major degradation or frequent failure
Version or commit#
0.0.45 (t3code-bin 0.0.45-1, Omarchy package)
Environment#
Omarchy 4.0.4 (Arch), Linux 7.2.5, tailscale 1.102.3
Logs or stack traces#
Failed to configure Tailscale Serve
Workaround#
Run sudo tailscale set --operator=$USER once, make sure MagicDNS and HTTPS certificates are enabled for the tailnet, then restart the server.
Related#
The missing way to enable Serve for t3 service install is proposed separately in Ideas: #16243
rubenmeza(GitHub profile, opens in a new tab) changed the title
Reproduced on Linux at main
b5a226e49cwith the real server and Tailscale 1.104.1, running as a non-operator. Startedserve --tailscale-serve --tailscale-serve-port 18443 --port 18638 --host 127.0.0.1against an isolated data directory. Tailscale exited 1 withpermission-denied; T3 loggedWARN: Failed to configure Tailscale Serve, then printedT3 Code server is readyandConnection string: http://127.0.0.1:18638. The listener stayed on loopback andtailscale serve status --jsonreturned{}. No duplicate found among the open issues.The startup fix needs a maintainer decision: the same Serve layer runs in CLI and desktop modes. Making all failures fatal can prevent desktop users from reaching the persisted setting that disables Serve; preserving desktop recovery requires mode-specific behavior. Stopped under the triage hard stop on runtime-mode changes. No fix was committed or pushed. Sanitized runtime transcript.
Confirmed again on Linux at main
a50cd989ae, using the real server withserve --tailscale-serve --tailscale-serve-port 18443 --port 18638 --host 127.0.0.1and isolated data. Tailscale returnedpermission-denied; T3 printed a warning followed by “T3 Code server is ready,” with only a loopback listener and no Serve mapping. Sanitized runtime transcript. No duplicate found among 916 open issues.Another common way to hit this on macOS with no misconfiguration at all: a login race after reboot. Because Serve is set up once and never retried, the mapping stays off until T3 Code is restarted.
Desktop 0.1.2-nightly.20261021.3473, Tailscale 1.104.2 (standalone Tailscale.app),
tailscaleServeEnabled: true:Time Event 13:29:44 Shutdown: the acquireReleasefinalizer runstailscale serve --https=443 off(succeeds)13:30:18 Mac boots 13:32:45 T3 Code (opened at login) runs ensureTailscaleServe→tailscale serve exited with code 1, logged asFailed to configure Tailscale Serve13:32:46 Tailscale.app process starts, one second later Afterwards
tailscale serve statusreportsNo serve config, the desktop probe ofhttps://<node>.ts.net/.well-known/t3/environmentfails with a transport error, and the mobile app cannot connect. Runningtailscale serve --bg --https=443 http://127.0.0.1:3773by hand, or quitting and reopening T3 Code, fixes it.Because the finalizer always removes the mapping on quit, a single failed attempt at startup always leaves Serve off. Retrying
ensureTailscaleServewith backoff while the setting is on (or re-running it when the desktop's existing probe sees the endpoint is down) would cover this case without the fatal-vs-recoverable question raised above.Same on Windows desktop (T3 Code 0.1.5, server 0.1.5, Tailscale 1.104.4), and here it hangs rather than failing fast.
Why it hangs: on a tailnet with Serve/HTTPS disabled,
tailscale serve --bg --https=443 http://127.0.0.1:3773does not exit. It prints the enable prompt to stdout and waits:Serve is not enabled on your tailnet. To enable, visit: https://login.tailscale.com/f/serve?node=<node>runTailscaleCommandonly collects stderr and waits for the exit code, so it sits untilTAILSCALE_SERVE_TIMEOUTfires, and the URL is thrown away:tailscale.runTailscaleCommand durationMs: 10615 TailscaleCommandTimeoutError: tailscale serve timed out after 10000ms. at server.runServerCommand (...)The UI just spins. After that,
desktop-settings.jsonhas"tailscaleServeEnabled": trueand everytailscale.probeTailscaleHttpsEndpointtohttps://<host>.ts.net/.well-known/t3/environmentfails withHttpClientError: Transport error.tailscale serve statussaysNo serve config, andtailscale status --jsonhas"CertDomains": null.Suggested fix:
- Read stdout as well, and treat a
login.tailscale.com/f/serveURL as a known failure: kill the child and show the URL in Settings → Connections (as proposed in #2830, which was closed as not planned). - Optionally check
CertDomainsfromtailscale status --jsonbefore callingserve, and fail right away with "Enable HTTPS certificates for your tailnet" if it's null. - Don't leave
tailscaleServeEnabled: truesaved whenensureTailscaleServefails (that's the recovery problem described above).
- Read stdout as well, and treat a
Another data point on the discarded stderr, from a NixOS 26.11 headless deployment (T3 Code 0.1.5 from numtide/llm-agents.nix, tailscale 1.104.2, systemd service running
t3 serve --tailscale-serveas a non-root service user).The remediation text isn't just missing from the log — it's captured and then thrown away. The failed CLI call wrote 194 bytes of stderr whose content is the fix itself:
sending serve config: Access denied: serve config denied Use 'sudo tailscale serve --https=7298 http://127.0.0.1:3773'. To not require root, use 'sudo tailscale set --operator=$USER' once.But the structured error only keeps the tag:
Failed to configure Tailscale Serve { cause: { _tag: 'TailscaleCommandExitError', executable: 'tailscale', subcommand: 'serve', argumentCount: 4, exitCode: 1, stderrLength: 194, stderrDiagnostic: 'permission-denied' }, localPort: 3773, servePort: 7298 }If
runTailscaleCommandsurfaced (or even truncated-kept) the last lines of stderr instead of a single diagnostic token, this class of report would diagnose itself.One wrinkle beyond the operator remedy: even with
OperatorUserset, serve is still denied unless the operator can runsudo tailscalepasswordless — the check then returns a different message (401 Unauthorized: must be root, or be an operator and able to run 'sudo tailscale'…). On declarative distros like NixOS that means a sudoers NOPASSWD rule for a nix store path that changes on every upgrade, which is not a real answer. The pattern that actually works there is the one @hrsong99 used by hand: keep the server on loopback and let a root-owned unit own the mapping (ExecStartPre=tailscale wait; ExecStart=tailscale serve --bg --https=<port> http://127.0.0.1:3773). Might be worth a line in the docs for the headlesst3 serve/t3 service installpath, since a Linux service user can never satisfy the current requirement cleanly.Fresh evidence on v0.1.6 desktop (Linux AppImage), a variant of this issue where
tailscale servehangs instead of returning an error. With HTTPS certificates disabled on the tailnet,tailscale serve --bg --https=<port> http://127.0.0.1:3773prints "Serve is not enabled on your tailnet. To enable, visit: …" and blocks waiting for approval. The server kills it after 10s (TailscaleCommandTimeoutError: tailscale serve timed out after 10000ms), and Settings shows nothing. The only remedy, the admin-console link, never reaches the user. (#2830 reported the same and was closed as stale.)The source already detects this.
readTailscaleStatuscomputeshttpsServeEnabledfrom thehttpsCapMap entry (packages/tailscale/src/tailscale.ts:216), but onlyt3 pairchecks it (apps/server/src/cli/pair.ts:370). The desktop toggle and server startup run serve anyway. CheckinghttpsServeEnabled === falsebefore both the toggle and the serve call would let the UI say "Enable HTTPS certificates in the Tailscale admin console" and skip a doomed restart. On AppImage that restart also hits #16629, so the app just disappears.Confirmed fix: enabling HTTPS Certificates in the admin console, then starting the app again → serve is configured and
https://<node>.ts.net/.well-known/t3/environmentreturns 200.Triage by Niss (Claude Opus 5.5, claude-opus-5-5) via
t3 triage, Claude Code.Still present in v0.1.7 desktop (Ubuntu, .deb), Tailscale 1.104.5, user not set as Tailscale operator — both the hidden failure and the "Enable becomes a no-op" problem from the Oct 8 comment.
Steps
- Linux, tailscaled running as root, desktop user is not the Tailscale operator.
- Settings → Sharing & access → Tailscale HTTPS → Enable (port 443).
tailscale serve --bg --https=443 http://127.0.0.1:3773exits 1 withAccess denied: serve config denied(stderr suggestssudo tailscale set --operator=$USER).- Dialog closes, switch stays off, no error shown.
- Click Enable again → nothing happens: no relaunch, no new serve attempt.
Diagnosis (v0.1.7 source)
apps/server/src/server.ts(layerTailscaleServe): failure is caught →logWarning("Failed to configure Tailscale Serve")→null. The stderr classifier (packages/tailscale/src/tailscale.ts:63) does tag this aspermission-denied, but that never reaches the UI.apps/desktop/src/backend/DesktopServerExposure.ts:598:requiresRelaunch: result.changed.tailscaleServeEnabledis persistedtruebefore Serve has worked, so later Enable clicks see no change and the IPC handler never relaunches — even though the dialog says it will restart the backend. Same line is unchanged onmain.- The switch is bound to probe reachability (
ConnectionsSettings.tsx:917,status === "available"), not the setting, so UI shows "off" while the setting is "on".
Evidence (desktop.trace.ndjson) Three
desktop.settings.setTailscaleServe {enabled: true, port: 443}spans over ~6 minutes, each followed only by a failingGET https://<host>.ts.net/.well-known/t3/environmentprobe; no relaunch and no furthertailscale servecall.Expected Surface the permission-denied error with the operator command; don't leave the setting on after a failed attempt (or treat "setting on + endpoint unavailable" as needing a relaunch so Enable retries).
Workaround
sudo tailscale set --operator=$USER, then restart T3 Code.T3 Connect appears off after every restart even though it relinks by itself.
releaseManagedTunnelOnShutdown deletes the tunnel and clears the local runtime config. On startup, reconcileDesiredLinkWith provisions a new tunnel within about 10 seconds. Settings reads connect.linkState during that window (00:17:56, with the config applied at 00:17:58) and doesn't read it again, so the toggle looks off.
Flipping the toggle then runs a second link. That restarts the tunnel, and if it overlaps the automatic relink it can fail with managed_endpoint_provisioning_failed (trace ID 3c4f60932aca73f5a85592f3f33fe64b).
Expected: show a reconnecting state during startup and refresh when the link is applied.
Confirmed: after the automatic relink, Settings kept showing T3 Connect as off. Moving between Settings pages didn't fix it, and no new /api/connect/link-state request reached the server for at least 3 minutes, even though the page is meant to re-check every 30 seconds.
t3 connect statusshowed it connected, and Ctrl+R immediately showed the correct state.
Produced by Claude Code (Claude Opus 5.5) via
t3 triage.tanstack-source added labelsbug
Note
🤖 Claude Fable 5.2 responding on behalf of jdueadev
Another case of this, on Windows, where the failure was transient and one retry would have recovered it.
Environment: Windows 11 Pro, desktop app run from a source checkout at
d1909d68f8(server 0.1.8), Network access on,tailscaleServeEnabled: truein the desktop settings.What happened: on at least four server starts in one night,
tailscale servefailed and Serve was never configured;tailscale serve statusreported no serve config while the saved setting stayed on. Two failure shapes indesktop.trace.ndjson, spantailscale.runTailscaleCommand:TailscaleCommandTimeoutError: tailscale serve timed out after 10000mson two starts. At least one of them fell while the network was coming back after a restart.TailscaleCommandExitError: tailscale serve exited with code 1after 57 ms on two starts, one of them with working internet and Tailscale connected.
Why a retry matters here: with nothing else changed, running
tailscale serve --bg http://127.0.0.1:3773by hand later succeeded at once. The start-up path inapps/server/src/server.ts(layerTailscaleServe) tries once and maps any failure tonull, so the server ran each whole session without Serve.Two things that would have helped:
- Retry with backoff while the setting is on, or try again when Tailscale reports connected.
- Keep the command's stderr in
TailscaleCommandExitError. "exited with code 1" gave no way to tell the cause, so I cannot say why the two fast failures happened.
Another reproduction, from the desktop app's Settings → Connections → Tailscale HTTPS dialog.
Environment: T3 Code desktop app (AppImage) 0.1.9 (server 0.1.9), Fedora 45, COSMIC desktop, Tailscale 1.104.6. MagicDNS was on, HTTPS certs were enabled, and the node had a cert domain.
What the user saw: clicking Enable in "Set up Tailscale HTTPS?" closed the dialog, the backend restarted, and the toggle went back to off. No error appeared anywhere in the UI.
Cause: Tailscale had no operator set (
OperatorUserwas absent fromtailscale debug prefs), sotailscale serve --bg --https=443 http://127.0.0.1:3773failed when run as the user. The server trace has two failedtailscale.runTailscaleCommandspans:TailscaleCommandTimeoutError: tailscale serve timed out after 10000ms. TailscaleCommandExitError: tailscale serve exited with code 1.In v0.1.9,
apps/server/src/server.tscatches the failure, logsFailed to configure Tailscale Serveas a warning and returnsnull, so the desktop never learns the setup failed.stderrDiagnostic(which would have beenpermission-denied) did not reach the trace either.Workaround:
sudo tailscale set --operator=$USER, then Enable again. After that, Serve came up andtailscale serve statusshowed the proxy to the backend.Suggestion: when
stderrDiagnosticispermission-deniedon Linux, the setup dialog could show the error and suggest the operator command. #30005 looks like it would cover the "show the error" half.
Comment drafted by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, via
t3 triage.Note
🤖 Claude Fable 5.2 responding on behalf of Jiffywu
The macOS reboot race from the Oct 22 comment still happens on 0.1.10-nightly.20261113.4616, and the 30-second repair loop that exists now does not recover from it.
Environment: macOS 27.2.1 (Apple silicon), desktop app 0.1.10-nightly.20261113.4616, Tailscale 1.104.5 (standalone app),
serverExposureMode: "network-accessible",tailscaleServeEnabled: true.Timeline (local time, from
desktop.trace.ndjsonandserver.trace.ndjson):Time Event 00:44:18 Normal shutdown ( desktop.lifecycle.beforeQuit)00:46:52 Mac boots 00:47:20 Tailscale network extension starts 00:47:22 T3 Code starts, opened at login 00:47:25 tailscale.readTailscaleServeRootHolderfails withTailscaleCommandTimeoutError: tailscale serve timed out after 3500ms;tailscale statustimes out the same way00:47:59 onward tailscale.readTailscaleServeRootHoldersucceeds every 30 s, 140 times over the next 70 minutesIn those 70 minutes the server trace has no
tailscale.ensureTailscaleServeortailscale.runTailscaleCommandspan.tailscale serve status --jsonhad no entry for port 443, the server listened on127.0.0.1:3773, andhttps://<node>.<tailnet>.ts.netrefused connections from this machine and three other tailnet devices. Another desktop environment could not load this machine's threads. Runningtailscale serve --bg --https=443 http://127.0.0.1:3773by hand fixed it at once.Why the repair loop does not help (from reading
layerTailscaleServein the shipped bundle, not from a debugger):- At startup the holder read fails, so
holderis"unreadable"and the layer returns without callingensureTailscaleServe. - The loop that follows acts only on
holder === "dead". - The shutdown finalizer had removed the root route, so every later read returns
"none", which the loop ignores.
So one slow answer from Tailscale at login leaves Serve off until the app is restarted, while the setting stays on.
Suggestion: when the startup read was
"unreadable", make the startup decision again on the first successful read, so"none"leads toensureTailscaleServe. A longer first timeout alone would not be reliable here: Tailscale had started only two seconds before the app.Seen once on this machine. The Serve route was present after an app restart earlier the same evening, when Tailscale was already running.
- At startup the holder read fails, so
Same silent failure in the Linux desktop app (AppImage, Beta channel). There's also a second trigger for the "dialog closes and nothing happens" symptom.
Environment
- T3 Code desktop 0.1.10 (server 0.1.10), Linux x64 (CachyOS, kernel 7.3.4)
- Tailscale 1.104.6 (tailscaled), installed as a system package
- Desktop exposure mode:
network-accessible
What happened
desktop-settings.jsonhad"tailscaleServeEnabled": truesince Nov 16, buttailscale serve status --jsonreturned{}.- Two causes, and the UI showed neither:
- HTTPS certificates were off for the tailnet.
Self.CapMaphad nohttpskey andCertDomainswas empty, soensureTailscaleServefailed withTailscaleServeHttpsDisabledError, and the server only logged "Failed to configure Tailscale Serve". - The user wasn't the Tailscale operator (
OperatorUserunset). On Linux this alone makestailscale servefail for a non-root user.
- HTTPS certificates were off for the tailnet.
- Clicking Enable in Settings → Connections did nothing. The desktop trace shows 4 calls to
desktop:set-tailscale-serve-enabled, allSuccess, and no relaunch. InsetTailscaleServe, the stored value was alreadytrue/443, sochangedwas false andrequiresRelaunchwas false. The modal closed, the backend didn't restart, and nothing retried Serve. Each click's follow-up probe ofhttps://<node>.ts.net/.well-known/t3/environmentfailed withHttpClientError: Transport error, and that wasn't shown either. - The switch is drawn from a live probe of the HTTPS endpoint (
checked={tailscaleHttpsEndpoint.status === "available"}), not from the saved setting. So the UI showed off while the stored value was alreadytrue, and every Enable click saved the same value and was dropped as unchanged.
Fix that worked
- Turn on HTTPS certificates in the Tailscale admin console (DNS page).
sudo tailscale set --operator=$USER- Quit and reopen T3 Code. Serve was configured at startup, and
/.well-known/t3/environmentover HTTPS returned 200.
Suggestions
- When the saved setting is already on but Serve isn't actually set up, the Enable action should retry
ensureTailscaleServeor restart the backend. - Show the specific failure in the UI and give the fix: HTTPS certs disabled (link to the admin DNS page), or operator not set (
sudo tailscale set --operator=$USER).
Diagnosed with T3 Code triage by Claude Code (Claude Opus 5.5).
Note
🤖 Drafted with Claude Opus 5.5
Same macOS race on the stable 0.1.10 desktop app (server 0.1.10), Tailscale 1.102.2 (standalone app), macOS 27.2.1,
tailscaleServeEnabled: true,tailscaleServePort: 8443. Here it goes through the ensure-failure path, where the 30-second repair loop is never started (the Nov 13 comment above went through the"unreadable"path).Trigger: a user-session logout and login, not a reboot.
Time (local) Event 02:55:58 Session logout; the finalizer runs tailscale.disableTailscaleServe(succeeds)02:56:16 Tailscale network extension restarts 02:57:27 T3 Code reopened at login ( desktop.serverExposure.configureFromSettings)02:57:30 tailscale.ensureTailscaleServefails:TailscaleCommandExitError: tailscale serve exited with code 1.02:57:35 Tailscale.app starts After that there is no further
ensureTailscaleServeorrunTailscaleCommandspan,tailscale serve statushas no entry for 8443, and another Mac's linked environment sees this one as unreachable (connection timeouts on/.well-known/t3/environment). Runningtailscale serve --bg --https=8443 http://127.0.0.1:3773by hand fixed it at once. The same sequence happened once before on this machine, a week earlier.Why the loop doesn't help here (from reading
layerTailscaleServein the shipped 0.1.10 bundle): thecatch_afterensureTailscaleServemaps the failure tonull, and thetapthat starts the 30-second repair loop does nothing whenconfigured === null. One failed attempt at startup leaves Serve off for the whole session while the setting stays on.Suggestion: start the repair loop even when the first
ensureTailscaleServefails, and have it ensure the route on"none"as well as"dead"while the setting is on (or retry with backoff until it succeeds).Workaround we use: turn Tailscale HTTPS off in Settings → Connections and keep a hand-made
tailscale serve --bg --https=<port> http://127.0.0.1:3773route. T3 then leaves it alone, so it survives quits, logouts and reboots.Confirming this exact silent failure still reproduces on T3 Code Beta 0.1.11 (macOS 15.7.9, Apple Silicon), Tailscale
1.98.5.What happened#
- Clicked Enable Tailscale (port 443) in Desktop Settings → triggered a T3 Code restart.
- Because HTTPS certificates were disabled on the tailnet,
tailscale.ensureTailscaleServefailed inserver.trace.ndjson:TailscaleServeHttpsDisabledError: Tailscale Serve needs HTTPS enabled on the tailnet. Enable HTTPS certificates at https://login.tailscale.com/admin/dns. - Nothing was surfaced in the UI — the toggle stayed off.
- Clicking Enable Tailscale again appeared to do nothing (
desktop:set-tailscale-serve-enabledreturnedSuccesswith no relaunch, followed byGET https://<node>.ts.net/.well-known/t3/environmentfailing withHttpClientError: Transport error— also not shown in the UI).
Surfacing
TailscaleServeHttpsDisabledError(with thehttps://login.tailscale.com/admin/dnslink) directly in Settings would save users from having to dig intoserver.trace.ndjson.
Sign in to join this conversation.
Same failure in the macOS desktop app, plus a second bug that stops it from recovering.
Steps
tailscale servefails.tailscale certreturns "your Tailscale account does not support getting TLS certs". The switch shows off, anddesktop-settings.jsonnow has"tailscaleServeEnabled": true.tailscale servecall, and the switch stays off.The dialog says T3 Code will restart the local backend, but
setTailscaleServeEnabledreturnsrequiresRelaunch: result.changed(apps/desktop/src/backend/DesktopServerExposure.ts:532ond7202109). The saved flag and port already match from step 1, so nothing relaunches. The server callsensureTailscaleServeonly at startup (apps/server/src/server.ts:781), so Serve stays off until the user quits and reopens the app. Quitting and reopening fixed it here.#14746 hits the same no-op relaunch in its DNS case. #15027 changes which state the switch reads but not the relaunch, so after it lands, step 4 would show the switch already on with a health note, and the only way to retry would be to turn it off and on again.
A possible fix is to relaunch whenever the user confirms Enable, for example
requiresRelaunch: result.changed || input.enabled, which matches what the dialog says.T3 Code 0.0.46-nightly.20261007.2787, macOS 26.5, Tailscale 1.102.4.