Repository navigation
[Bug][Desktop 0.2.1-rc.3] Auth cookies accumulate across restarts, causing HTTP 431 and startup failure #11397
Replies: 9 comments 1 reply
|
I found an earlier discussion reporting the same root cause and measurements: This appears to be the same HTTP 431 authentication-cookie accumulation issue. I'm linking the two discussions to help maintainers consolidate investigation and tracking. |
|
Your root cause is the right one, and it is still unfixed in the newest tree. I checked Two additions for the report:
Your linked #11374 is the same bug; between the two threads the useful signal is that this reproduces on macOS as well as Windows, so it is not an ACL or a Windows-specific cookie-store quirk. Source read at |
|
我也遇到了这个问题,以下是Claude代码的解决方法:问题已修复,应用程序现在可以正常启动了。##根因不是网络、账号或登录过期,而是本地Cookie请求头超出了主机进程16 KB的上限:-每次启动时,本地主机将随机分配端口,并签发一个dsh-auth-<hash(127.0.0.1:端口)> Cookie。由于端口每次都不同,旧Cookie永远不会被复用,而保质期是30天。-你的Cookie库里已经积累了71个dsh-auth-,合计16,117字节,加上其他请求头后超过Node HTTP 默认的16,384字节限制。- 本地主机直接返回431请求标题字段太大,电子的net.fetch拿不到响应成功,因此报桌面欢迎:网络身份验证失败。-这也每次为什么重试都失败,并且失败本身还会再写入一个Cookie让,问题持续加重。##验证过程-用Chromium网络日志复现:请求主机的真实响应是HTTP/1.1 431请求标题字段太大。-手动启动主机,用卷曲测试:单个Cookie返回303→200,说明服务端认证逻辑完全正常;带16.5 KB Cookie时立即返回431。-你给的崩溃日志本身只是表象,停在connectDesktopWelcome的!认证。好的,判断上。## 已做的修复1.已备份Cookie库到/tmp/dsh-extract/Cookies.before-fix。2.关闭应用程序后,从Cookie库删除了全部127.0.0.1的dsh-auth- Cookie。3.重新启动验证:主机正常运行、模型列表正常加载、没有新的崩溃日志、应用程序已在你屏幕上打开。配置文件和插件清单没有被改动过(cordis.patch.yml是应用程序运行时自己写入的)。##注意事项这个问题约1-2周后复发(阈值约70个饼干,你大约10天积累了71个)。长期方案有两个:-向DeepSeek反馈:签发的Cookie名称包含随机端口且不清理,建议主机提高maxHeaderSize或清理过期Cookie;-我可以帮你做一个登录项/定时脚本,在应用未运行时定期清理这些Cookie。需要的话告诉我,我来配置自动清理。 |
|
Thanks — both additions check out, and the 431-before-welcome point is the one that cost us the most time: the error names authentication, so we burned a round on reinstall before finding the jar.
We're on a shipped app.asar here (Windows), so we can't patch the source. We put a pre-launch guard in front of the desktop app instead: when `dsh-auth-*` crosses a threshold it backs up the cookie store, prunes to the newest, snapshots/restores the profile, then starts the app. That's your first option implemented outside the app — it buys headroom but still mints one cookie per launch. Keying the name by host only is the real cure; if it lands, please also purge legacy `dsh-auth-*` whose suffix doesn't match the new key on write, or upgraded installs keep them for 30 days and can still hit 431.
One more thing from this machine: the 431 doesn't stop at the welcome page — the failed launch goes through fatal recovery, which renames `cordis.patch.yml` to `.bak-<ts>` and cuts `dsh.profile.bundles` from 35 to 2. Fixing the jar removes this trigger, but any startup failure walks the same path; looks like its own issue.
If there's ever a patched build to try, I'm on Windows and glad to re-run the launch loop and report back.
|
|
谢谢你把 Chromium netlog 那组和 curl 对照(单 cookie 303→200、16.5 KB 直接 431)写出来,把「认证坏了」和「请求头爆了」分干净了,这个验证过程很有用。
我们这边也撞的是同一个问题,已经恢复了:把 127.0.0.1 下的 dsh-auth-* 全清了一遍,重启就正常。另外加了一个启动前的清理(每次启动先把旧 cookie 清到只剩一条,带备份),实测 2 条 → 1 条、新随机端口正常起。数字也对得上:我们数到的也是 71 条、约 16,117 B。
有一条友情提醒,可能你那边也会踩到:失败不一定停在欢迎页。这边有一次启动失败走了 fatal recovery——`cordis.patch.yml` 被改名成 `.bak-<时间戳>`,`dsh.profile.bundles` 从 35 项砍到 2 项(包和 node_modules 都还在,但配置没了)。所以「删完 cookie 就好了、配置没动」可能是这次走运,不是必然;我担心连续失败几次,配置会跟着丢。建议顺手存一份 profile 快照。
关于长期方案,我说说我的顾虑,不一定对:调大 maxHeaderSize,我担心只是把「约 70 次」这个周期往后推,头还是会涨,还可能盖住下一个同类问题。我倾向根治在写 cookie 那一侧——名字按 host 而不是 authority(端口不进 hash),写入时顺手清掉同族旧 `dsh-auth-*`。(这个思路你可以交给Claudecode评估一下在你那台设备上的可行性 )这跟 issue 里另一位说的 jar boundary 是同一处。
关于定时清理脚本,这边有两个已经踩过的坑希望对你有帮助:旧实例还没退完时,cookie 库被独占锁,点起来会静默没反应(要等它真的退出);连点两下会启动两个进程抢同一个库(要加互斥)。需要的话我可以把脚本思路贴出来。
再次谢谢你把这些数字和验证过程写清楚。
|
|
Checked the recovery path in source. The rename comes from the dialog's third button, not from the failed launch itself.
What Two things worth correcting in the report:
|
|
Sorry for the false report. I pressed the third button on the recovery
dialog — "disable third-party plugins" — and didn't connect it to the bundle
list being rewritten. Your trace is correct and this is user error on my side,
not a bug.
What's on disk here matches it: the leftover backup is
cordis.patch.yml.bak-1793240957627, 217 bytes, i.e. the empty template, and
1793240957627 decodes to 2026-10-29T02:28:56Z (10:28:56 local), exactly when I
was in that dialog. Esc and Enter couldn't have reached that write. Sorry you
had to read the source for an answer that shouldn't have needed it.
Two things back:
- You're right that the old bundle list has no copy anywhere. What saved us was
an unrelated package.json snapshot from an earlier plugin install; without it
the 35 entries would have had to be retyped by hand. I worry the next person
who presses that button will file the same "plugins vanished" bug, so keeping
the previous bundles next to the patch .bak would make it recoverable by
anyone, not only by whoever happened to take a snapshot.
- If it's cheap: is the prompt explicit that this rewrites the profile's bundle
list and does not come back on the next launch? That's the part I got wrong.
Closing this as user error on my side. Thanks for reading the source instead of
pointing me at the docs.
|
|
Adding a Windows datapoint on 0.2.1-rc.5, plus one correction to a detail above. Confirms on Windows / rc.5 too. Same numbers as the report: 71 Exact threshold from the launch sequence. Two consecutive launches on this machine bracketed it precisely:
Isolated the two halves the same way others did: Correction: the count does not keep growing after the first failure. Comment above says "失败本身还会再写入一个 Cookie,让问题持续加重". On this machine it is the opposite — it freezes:
The 431 is produced before On suggested fixes. Agree with the jar-boundary conclusion. One caveat for option "key the name by host only": on upgrade, legacy cookies keyed by the old Also worth folding into diagnostics: surfacing the real status ( No raw cookies, tokens, or the cookie DB included. Happy to re-run a launch loop against a patched build on Windows if useful. |
|
Short answer: no. The button is the only place the action is named — What the code actually does, for the record: If one thing changes in a follow-up, the label plus one line in On @elegant01's bracket: the server is And thanks for checking the timestamp yourself, |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
DeepSeek Harness Desktop
0.2.1-rc.3can fail to launch after repeated restarts with the following error:I investigated this issue on macOS arm64 and identified a reproducible cause: stale authentication cookies accumulate across launches until the HTTP Cookie header exceeds Node.js's default 16 KB request-header limit.
The server then returns HTTP 431, which the Desktop application incorrectly reports as an authentication failure.
I verified that clearing the stale cookies restores the application without reinstalling it.
Environment
0.2.1-rc.344.7.024.21.0zh-CNThe application passed code-signature and integrity verification.
Root Cause Analysis
127.0.0.1using a new random port on each launch.dsh-auth-<base64url(sha256(authority))>, whereauthorityincludes the randomly assigned port.In the affected session, I measured:
dsh-auth-*cookiesname=value;entriesOnce ordinary HTTP headers are included, the request exceeds the limit and the server returns:
HTTP/1.1 431 Request Header Fields Too LargeThe Desktop welcome handler checks only whether the response is successful and reports HTTP 431 as a generic authentication failure. The subsequent recovery guidance incorrectly recommends reinstalling the application, although reinstalling does not necessarily remove persistent Electron cookies.
Direct Verification
I reproduced the welcome request using Electron's
net.fetch:Observed results:
The application installation and user profile remained unchanged. This supports cookie accumulation, rather than corrupted application files, as the immediate cause of this failure.
Steps to Reproduce
0.2.1-rc.3.Web authentication failederror.dsh-auth-*cookies from its Electron session.For deterministic regression testing, seed a fresh Electron session with approximately 70
dsh-auth-*cookies forhttp://127.0.0.1/, each with a value close to 173 bytes, before attempting the welcome handshake.Suggested Fixes
Immediate mitigation
Remove stale local authentication cookies before initiating the Desktop welcome handshake:
Long-term improvements
Relevant Code Locations
Based on the packaged Desktop
0.2.1-rc.3runtime:app.asar/lib/main.js:authenticateWebHost()around line 8229.app.asar/lib/main.js:connectDesktopWelcome()around lines 8882–8886.@deepseek-ai/dsh-client-connection/lib/index.js:authenticatedUrl()around line 440,authorizeIndex()around line 458, and default cookie age around line 1017.@deepseek-ai/dsh-host-webserver/lib/index.js: HTTP server creation around line 412.Impact
This issue can make the Desktop application completely unusable after frequent restarts. The current error message also incorrectly suggests reinstalling the application.
I recommend treating this as a high-priority Desktop reliability issue.
I have already sent a detailed report to
harness-service@deepseek.comon October 29, 2026.Could the maintainers confirm this issue and consider adding a fix to an upcoming release?
I can provide sanitized logs and further reproduction details privately if needed. I have not included raw authentication cookies, launch tokens or the cookie database in this public discussion.
Thank you.
All reactions