DeepSeek Harness Web authentication failed cookie 431 fix

TroubleshootingPublished 2026-10-30Author: DeepSeek Plugin Market
DeepSeek HarnessDSHdesktopWeb authentication faileddsh-auth431cookie accumulationstartup failure
DeepSeek Harness desktop fails with Web authentication failed because dsh-auth-* cookies pile up past the 16 KB header. Count, clear, and prevent it.

A DeepSeek Harness desktop install suddenly stops opening, and the only line in the log is desktop welcome: Web authentication failed. Reinstalling, switching accounts, and changing API keys all do nothing. In this family of cases the usual cause is not broken authentication: every launch adds another local dsh-auth-* cookie, and after roughly 70 rows the Cookie header exceeds Node's default 16,384-byte limit, so the host returns 431 before the welcome handler ever runs. This article skips generic "clear the cache" advice and follows a verifiable order: prove the header is over the limit, pick one recovery path, then deal with recurrence (#10831, #11366).

DeepSeek Harness: First, separate a real credential problem from a header problem

Web authentication failed is the shared error text of the welcome flow; both 401 and 431 land on that sentence. Only a 431 or header-size evidence proves cookie accumulation.

Split the three common situations before you reinstall anything:

  1. Credential problem: usually happens during a model request, the log shows MISSING_CREDENTIAL, a 401, or a provider name, and the UI still opens.
  2. Port or address problem: in a dsh web setup you did not use the token-bearing URL printed in the terminal, and the prompt explicitly asks you to reopen that URL.
  3. Header overflow: the desktop window never appears, the log stops at connectDesktopWelcome, and reinstalling does not help — this is the case in this article.

Confirmation takes three steps:

  1. Fully quit DSH, including the tray icon and any leftover background process; verify in Task Manager that no DeepSeek Harness process remains.
  2. Locate the cookie database: on Windows it is %APPDATA%\@deepseek-ai\dsh-desktop\Network\Cookies; on macOS it is ~/Library/Application Support/@deepseek-ai/dsh-desktop/Network/Cookies.
  3. Run SELECT COUNT(*) FROM cookies WHERE host_key LIKE '%127.0.0.1%' AND name LIKE 'dsh-auth-%'; in any SQLite client. A result near 70 is the answer.

The cookie name is dsh-auth- plus base64url(sha256(host authority)). Because the desktop host uses a random port on every launch, the name is different each time; the write sets only a 30-day Max-Age and never deletes older names.

The chain has four steps:

  1. The desktop app starts the local host on a random 127.0.0.1 port.
  2. The welcome flow hashes the current authority into a cookie name and mints a new dsh-auth-*.
  3. The browser cookie database stores rows by domain, path, and name; a new name is a new row, and old rows stay.
  4. The next launch uses another port and adds another row. Around 70 rows, the Cookie header passes 16,384 bytes and the host answers 431.

The size is easy to check: the community measured about 226 bytes per entry (52-byte name + 1-byte equals sign + 173-byte value). 71 entries plus 70 ; separators come to 16,186 bytes, already over Node's default limit (#10828).

LaunchesCookie header sizeResult
60 rows13,824 BStarts normally
64 rowsAbout 14,700 BStarts normally
65 rowsAbout 14,900 BSome environments start failing
71 rows16,186 B431 every time

The important part: old cookies do not affect server-side validation. authenticate() only looks up the entry for the current port; the other 70 are pure header weight. So the answer to "will clearing old cookies break authentication" is no — the current launch mints a new one (#11366).

DeepSeek Harness: Recovery: three ways to clear, ordered by risk

The safest move is to move the whole Network/Cookies file aside; if you want to keep cookies for other sites, delete only the dsh-auth-* rows; use the header-limit workaround only when you need to get in and export data first.

  1. Fully quit DSH and confirm both the tray process and any background process are gone.
  2. Open the Network directory and rename Cookies and Cookies-journal, for example with a .bak suffix.
  3. Start DSH again; the app recreates a fresh cookie database.
  4. Once the main window opens, decide whether to keep the backup. If startup still fails, rename the files back to roll back.

This clears cookies for every site embedded in the desktop client, but it does not touch DSH data: sessions, plugins, and credentials are not stored there.

Option 2: Delete only dsh-auth-* rows (keep other cookies)

  1. Quit DSH and copy the Cookies file as a backup.
  2. Open it with SQLite and run:
sql
DELETE FROM cookies
WHERE host_key LIKE '%127.0.0.1%'
  AND name LIKE 'dsh-auth-%';
  1. Close the database and start DSH again.
  2. If startup succeeds, watch the next restart: a new row is expected, which means the mechanism is still there and only the counter was reset.

Do not edit the database while the app is running. SQLite WAL and the in-memory cache can write the old rows back on exit, which looks like "I deleted them but nothing changed".

Option 3: Raise the header limit temporarily (data rescue only)

  1. Quit DSH.
  2. Set NODE_OPTIONS=--max-http-header-size=131072 in the launch environment.
  3. Start DSH; 71 cookies are now accepted, so export the sessions or files you need.
  4. Afterward, still clean up with option 1 or 2. Do not keep running with this variable.

This only raises the ceiling. Cookies keep accumulating, and the same failure returns at the new ceiling.

DSH Plugin: Prevention: wait for the official fix, or patch it yourself

As of the community re-check, the official build is still unfixed: rc.2, rc.3, and rc.4 share the same naming and write logic in browser-auth.ts, while the community patch was verified to start normally on rc.4.

If you do not want to clean manually every time, there are three directions:

  1. Clear same-family cookies at startup: call session.clearStorageData({ storages: ["cookies"] }) during Electron carrier startup. The community used this in another carrier that attaches a runtime on a random port and it ran for weeks; the cost is clearing all cookies.
  2. Drop the port from the cookie name: hash the authority without the port so multiple launches on one machine reuse one name, overwriting the value instead of adding a row.
  3. Clean up selectively at startup: keep backward compatibility, but delete rows that are same-domain, start with dsh-auth-, and do not match the current name. This touches only your own cookies.

One more change is easy to overlook: include the HTTP status code when connectDesktopWelcome throws. Right now 401 and 431 share the same Web authentication failed sentence, leaving users to guess. Exposing the status code at least separates a credential problem from a header problem immediately (#11408).

DeepSeek Harness: Things not to do

The following moves either worsen the failure or hide the real cause; avoid them before attempting a fix.

  1. Do not reinstall to "fix" this. The cookie database lives in userData, and uninstalling usually leaves it behind, so the counter survives and the reinstall looks useless.
  2. Do not delete cookie files while DSH is running. Fully quit first; otherwise WAL may write the old rows back.
  3. Do not treat NODE_OPTIONS as a long-term fix. It raises the ceiling but does not stop accumulation.
  4. Do not run the desktop app and dsh web against the same DSH_HOME. Both instances mint cookies, doubling the accumulation rate and amplifying other concurrent-write problems.
  5. Back up before cleaning. The Cookies file and the whole Network directory are small; copy them first so you can roll back.

If you just need the app to open, option 1 is the fastest path. If you want to know whether you are in this family at all, count the cookies first and then check the log for 431. Once those two pieces of evidence line up, stop spending time on accounts and API keys.See dsh web authentication required: how to fix the prompt for the related case.

FAQ

When desktop startup shows desktop welcome: Web authentication failed, how do I confirm a dsh-auth cookie buildup in DeepSeek Harness?

Two traits separate a dsh-auth-* buildup from other DeepSeek Harness startup failures: reinstalling, changing the key, and changing the account all fail, and the startup log stops inside connectDesktopWelcome instead of a model request. To confirm, count the cookies: fully quit DSH, open Network/Cookies as SQLite, and count rows whose name starts with dsh-auth-. Around 70 or more means the header is over the limit.

Does clearing dsh-auth-* cookies in DeepSeek Harness remove my login state, sessions, or plugin configuration?

No, clearing dsh-auth-* does not touch sessions or plugin configuration in DeepSeek Harness, because the cookie is only a one-time local host authentication credential stored in the browser cookie database Network/Cookies. Session logs live under sessions, while plugins and credentials live in the profile and .credentials.yaml; none of them are touched. The next launch mints a fresh cookie from the token-bearing URL.

Why does clearing cookies keep DeepSeek Harness starting for a few days, before Web authentication failed comes back?

DeepSeek Harness keeps re-creating the cookie because the trigger never goes away: the cookie name is derived from a hash of the host authority, and the desktop host picks a random port on every launch, so each launch adds a differently named dsh-auth-*. Old names only carry a 30-day Max-Age and are never deleted. Clearing once resets the counter; the buildup continues at one row per launch.

Will moving DeepSeek Harness to 0.2.1-rc.4 or 0.2.2 fix it?

No, DeepSeek Harness is not fixed by rc.4: the community re-check on rc.4 confirmed that rc.4 is still not fixed; the naming and write logic in browser-auth.ts is unchanged, while the community patch was verified to start normally on rc.4. Whether a 0.2.2-alpha build contains the fix depends on the exact commit you installed, not just the version number. Clear the historical cookies once after upgrading.

On macOS, where does the dsh-auth cookie live in DeepSeek Harness, and is the cleanup the same as on Windows?

On macOS the DeepSeek Harness cookie lives in Network/Cookies under the desktop userData directory, which is usually ~/Library/Application Support/@deepseek-ai/dsh-desktop/. The cleanup is the same: fully quit the app, back up Cookies and Cookies-journal, then remove or rename them; the database is recreated on the next launch. Do not delete it while the app is running, or SQLite WAL may write the old rows back.

Related Terms

dsh-auth-* cookie
The `dsh-auth-*` cookie is a DeepSeek Harness desktop cookie used to authenticate against the local host, named `dsh-auth-` plus `base64url(sha256(host authority))`. The authority includes a random port, so each launch creates a new name; the cookie is written with a 30-day Max-Age and there is no path that deletes old names.— https://github.com/deepseek-ai/deepseek-harness/discussions/11366
maxHeaderSize
maxHeaderSize is the default size limit Node.js applies to a single HTTP request header, 16,384 bytes. When a request header exceeds it, the HTTP parser returns 431 before any application handler runs, which is why this failure is often wrapped as an authentication error.— https://github.com/deepseek-ai/deepseek-harness/discussions/10828
HTTP 431
HTTP status code 431 means Request Header Fields Too Large. In this DeepSeek Harness desktop scenario it is caused by accumulated Cookie headers, not by invalid credentials or an unavailable service.— https://github.com/deepseek-ai/deepseek-harness/discussions/10831
connectDesktopWelcome
connectDesktopWelcome is the desktop startup flow that connects to the local host and completes the handshake with the authentication cookie. Its `desktop welcome: Web authentication failed` error is a shared wrapper; the underlying cause can be a 401 or a 431, so the status code is what separates them.— https://github.com/deepseek-ai/deepseek-harness/discussions/11408

Sources