Repository navigation
Issue: Desktop startup fails with desktop welcome: Web authentication failed after stale dsh-auth-* cookies exceed the 16 KB header limit (HTTP 431) #12606
Replies: 1 comment
|
Same root cause as #12502/#12360: the desktop build accumulates Practical recovery until a fixed desktop build ships: fully quit DSH (tray → exit), remove the stale cookies from |
Uh oh!
There was an error while loading. Please reload this page.
Desktop startup fails with
desktop welcome: Web authentication failedafter staledsh-auth-*cookies exceed the 16 KB header limit (HTTP 431)Environment
@deepseek-ai/dsh-desktop0.2.2-rc.1Summary
The desktop app fails during startup and shows the fatal recovery dialog:
The failure is not caused by a corrupted installation, the
.dshprofile, or third-party plugins.It is caused by unbounded accumulation of local authentication cookies in Electron's default session:
--port 0).dsh-auth-<base64url(sha256("127.0.0.1:<port>"))>.cookieMaxAgeDaysdefault:30).connectDesktopWelcome()authenticates with Electronnet.fetch(..., { credentials: "include" }), which sends all cookies stored for127.0.0.1.Cookierequest header exceeds Node's default 16 KBmaxHeaderSize. The Host's HTTP server rejects the request with HTTP 431 Request Header Fields Too Large.connectDesktopWelcome()only checksauthenticated.okand reports every non-2xx response asdesktop welcome: Web authentication failed, hiding the real 431.Deleting the stale
dsh-auth-*cookies immediately restores startup.Actual behavior
%APPDATA%\@deepseek-ai\dsh-desktop\logs\crash-<timestamp>-host.logExpected behavior
The app should start normally even after many launches, and stale local authentication cookies should not cause an unbounded
Cookieheader.A non-2xx response should also produce a diagnostic containing the real HTTP status instead of a generic authentication error.
Reproduction
Natural reproduction
dsh-auth-<port-hash>cookie with a 30-day expiry.desktop welcome: Web authentication failed.Deterministic cookie-header reproduction
With the app closed, pre-populate the default Electron session with many cookies for
127.0.0.1(cookies are host-scoped, not port-scoped):Then start the app. The shell's authenticated
net.fetch()request receives HTTP 431 and fails with the same message.Evidence
1. Cookie database contained 71 stale
dsh-auth-*cookiesQuery against
%APPDATA%\@deepseek-ai\dsh-desktop\Network\Cookies:Summing
length(name) + length(encrypted_value)for those rows gives approximately 16.2 KB, which is already at/above Node's default 16 KB request-header limit once the rest of the request headers are included.All rows had:
host_key = '127.0.0.1'2. Node
fetch()succeeds while Electronnet.fetch()failsWith the Host running:
The Node path (
authenticateWebHost) does not use a cookie jar, so it never sends the accumulated cookies. The Electron path does use the default session and sends all of them.After deleting the 71
dsh-auth-*cookies and restarting, the app started normally and no new crash report was produced.Root cause in code
Relevant code paths (0.2.2-rc.1):
@deepseek-ai/dsh-client-connection— browser authentication:cookieName(authority)returnsdsh-auth-+base64url(sha256(authority)).requestAudience()returnsurl.host, which includes the ephemeral port.sessionCookie()writesMax-Age=2592000(30 days) by default.@deepseek-ai/dsh-desktop-host— starts the Web server with--port 0, so the authority changes on every launch.@deepseek-ai/dsh-desktop—lib/main.js:authenticateWebHost()uses Nodefetch(..., { redirect: "manual" })and returns the cookie without storing it.connectDesktopWelcome()then usesnet.fetch(ready.url, { credentials: "include" }).if (!authenticated.ok) throw new Error("desktop welcome: Web authentication failed")loses the actual status.Because Chromium cookies are not port-scoped, all previous
dsh-auth-*cookies for127.0.0.1are sent to the newly started Host, even though only one of them can match the new authority.Suggested fix
Use a stable cookie name that does not include the ephemeral port.
Cookie names are not port-scoped. A single name such as
dsh-authis sufficient because the launch-token exchange re-mints the cookie on every launch and overwrites the previous value. Keep the authority binding inside the signed cookie payload.Or clean up stale cookies before minting a new one.
Before
connectDesktopWelcome()/ at shell startup, delete alldsh-auth-*cookies for127.0.0.1from the Electron default session, then exchange the launch token for a fresh cookie.Or stop using the default cookie jar for this request.
Use a dedicated
session.fromPartition()for the welcome backend, or pass the cookie obtained byauthenticateWebHost()explicitly instead of usingcredentials: "include"with the default session.Preserve the real HTTP status in diagnostics.
Include
response.status(and a small response body when present) in the error. A 431 should be distinguishable from a genuine 401/403 authentication failure.Add a regression test.
Simulate many launches / pre-populate many
dsh-auth-*cookies and assert that startup still succeeds and that the number of cookies (or request-header size) stays bounded.Lowering
cookieMaxAgeDaysonly delays the problem and can break long-running sessions; it is not a complete fix.Workaround for users
%APPDATA%\@deepseek-ai\dsh-desktop\Network\Cookiesname LIKE 'dsh-auth-%'from that SQLite database.This does not sign the user out of the DeepSeek platform account; it only clears the local Host browser-session cookies.
A small launch wrapper can also purge
dsh-auth-*cookies before every app start to prevent recurrence.Impact
.dshuser data (credentials, sessions, storages, profiles, skills, plugins) was intact.All reactions