DeepSeek Harness Workspaces Gone: workspace.json sessionIds
After DeepSeek Harness (DSH) starts, the workspace list is blank and every session appears to be gone, while the front end offers only directoryPickerController is unavailable — a textbook case of "the symptom points at A, the cause lives in B", and the most common variant is a record in storages/workspace.json whose sessionIds an external script wrote as a string. Put the most important sentence first: this is not data loss. The session files are still on disk; the workspace domain threw during load and was never mounted, so no RPC can enumerate them. Restore the field to a valid shape, or restore the file from a backup, and everything returns after a restart (#11612).
First confirm the sessions are not lost: an unmounted domain is not missing data
Short answer: when the UI says "all sessions vanished", separate "the files are gone" from "the listing API cannot answer"; only the former is data loss. Three checks in order.
-
Look at whether the session files still exist. Sessions persist under
~/.dsh/storages/sessions/(%USERPROFILE%\.dsh\storages\sessions\on Windows, or the corresponding directory whenDSH_HOMEis redirected). Expected: the file count matches the session count and sizes look normal. Files present = data not lost. -
Check whether the workspace record file exists. The target is
storages/workspace.json. Expected: the file exists, is readable, and contains workspace entries. If this file itself cannot be read or parsed, the problem is right here. -
Compare against the "entries that did not activate" count in the startup log. Expected: a line like
warning: 5 entries did not activatefollowed by aDomainError. That number tells you how many services are stuck inpendingbecause a domain they depend on never mounted, which is direct evidence of the cascade (#11612).
As long as step 1 proves the files are still there, proceed with the repair confidently and leave the session data itself alone.
Locate it: two log lines narrow the range to one record and one field
The decisive signals: the DomainError gives the record id and the ZodError gives the field path; together they reduce the scope to a single field. Steps.
- Grab the DomainError line from the startup log.
DomainError: domain 'workspace': stored record 'b7ac4724-…'
in table 'workspaces' does not match its schema
Expected: three facts — the domain is workspace, the table is workspaces, the bad record id is b7ac4724-….
- Grab the ZodError field path right after it.
ZodError: path: ["sessionIds"], message: "Invalid input: expected array, received string"
Expected: the field is sessionIds, an array was expected, and a string arrived. The location step is done; no guessing needed.
- Find that record in
workspace.jsonby its id.
# macOS / Linux
grep -n "b7ac4724" ~/.dsh/storages/workspace.json
# Windows PowerShell
Select-String -Path "$env:USERPROFILE\.dsh\storages\workspace.json" -Pattern "b7ac4724"
Expected: one workspace record, and you can see the scalar form "sessionIds": "session-7f2c108b-…" with the naked eye.
- Count whether other malformed values exist too. A file may hold more than one. Search every scalar of the form
"sessionIds": ". Expected: if only one turns up, one repair is enough; if several do, fix each.
Repair: turn the scalar back into an array, then restart
Short answer: there is exactly one repair — sessionIds must be an array, so "session-…" becomes ["session-…"], and a restart finishes it. Steps.
- Back up the whole storages directory to a location outside the workspace; it is your only rollback:
cp ~/.dsh/storages/workspace.json ~/.dsh/storages/workspace.json.bak. - Change only the shape of
sessionIdsand leave every other field alone. Turn"sessionIds": "session-7f2c108b-…"into"sessionIds": ["session-7f2c108b-…"], which is just wrapping the value in brackets. - Validate that the JSON is still legal. Run it through any JSON parser. Expected: no syntax errors. The most common second accident in hand editing is one comma too many or too few.
- Restart
dsh web. Expected: no moreDomainErrorfordomain 'workspace', theentries did not activatecount drops or disappears, and the workspace list returns. - Confirm the sessions are back. Open the session list. Expected: every previously "vanished" session is listed and opens normally.
The reporter and the responder each verified this path: revert to an array, restart, and the workspace list and all sessions come back with no data loss. If you have a backup, restoring the same file works equally well (#11612).
Mechanism: why one bad record can drag down an entire domain
Short answer: the workspace domain validates as a whole and fails as a whole, with no per-record skipping; once the domain cannot open, every service waiting on it stays pending. The chain, step by step.
- The schema declares an array.
packages/workspace/workspace/src/spec.ts:29declaressessionIds: z.array(sessionId). That is the single source of truth, and a string can never match it. - The persistence boundary throws per domain.
parseRecordatpackages/storage/storage-domain/src/index.ts:200-209throwsDomainError('invalid-record', ...)while parsing records and has no skip branch. So one bad record equals an entireworkspacedomain that fails to open. - Dependent services all go pending. The responder lists
sessionController,schedule,workspaceController, andui-deliverablesas affected. They never see the domain ready, so their initialization hangs. - The client reports only the first downstream error it hits. What you see is
typert gateway: directoryPicker/list: active Service "directoryPickerController" is unavailable, because clicking "choose workspace directory" is the first call to fire. That message is two layers away from the actual root cause, and searching by it leads you completely off track. - Version consistency shows this is not a one-release quirk. The responder checked that the
spec.tsschema andparseRecordare identical across rc.2, rc.5, and masterce7073d5. Changing versions does not change behavior; only the data or the product policy can.
Where the bad data comes from: writes that bypass DSH never get validated
Short answer: bad records almost always come from external scripts editing the file directly, and DSH's pre-write validation only applies when DSH itself writes. The thread's typical source is an old PowerShell trap.
- A pipeline collapses a single element into a scalar. An array with one item may come out of a pipeline as a bare string, and serializing it produces
"sessionIds": "session-…". - Nothing validates on write-back. The script overwrites
workspace.jsondirectly; DSH neither knows about the write nor gets a chance to intercept it. - The read side discovers it only on the next start.
parseRecordnotices the mismatch while loading, so the failure erupts on the following launch — which is exactly why many people feel "I changed nothing, it broke by itself". - How to reduce the risk: wrap arrays explicitly before a script writes JSON; on PowerShell 7 use
ConvertTo-Json -AsArrayto force array output; validate with a JSON parser before persisting. Also note that the log once showeddefault data dir not writableand fell back toDesktop\HarnessData; the fallback itself is unrelated to corruption, but it putsstorages/in a user-visible directory and noticeably raises the odds of external edits.
Be careful with the two-write mutation marker if you add record skipping
Short answer: per-record fault tolerance is the right product direction, but any implementation must preserve the two-write mutation marker in workspace.json, or an interrupted create/delete gets silently hidden. The responder raised three points.
- Where the marker lives: the two-write mutation marker at
spec.ts:36-40records a create or delete that stopped halfway; "skip per record plus startup self-healing" must not throw the record away together with its marker. - The ideal behavior is "skip loudly": when skipping a bad record, at least log
{domain, recordId, field, expected}so the user knows what happened instead of quietly losing one workspace. - There is no such switch today: the reply is explicit that skipping bad records is a product decision, not a configuration item users forgot to enable. So do not hunt for a hidden flag; fix the data. When filing an issue, attach the
DomainErrorandZodErrorlines plus theentries did not activatecount.
Things to keep in mind while debugging
The principle for cascade failures: read downward from the most upstream domain error, never guess upward from the most downstream UI message. Six points.
- Prove the data still exists before touching anything; sessions on disk are not lost data.
DomainErroris the root cause anddirectoryPickerController is unavailableis the symptom; never read them in reverse.- Change only the shape of the bad field — do not reorder the JSON, do not change ids, do not touch the two-write marker.
- Always back up first; hand-editing storage files has no rollback other than a backup.
- Do not expect a version change to fix it: the schema and
parseRecordare the same on rc.2, rc.5, and master, so switching releases changes nothing. - Confirm through the startup log afterwards: the
DomainErroris gone and the pending count dropped, and only then is it really fixed.
Source: Discussion #11612.
FAQ
Usually not in DeepSeek Harness. The session files are still on disk; the workspace domain threw while loading and never mounted, so no RPC that enumerates sessions can answer and the UI looks empty. Restore the broken field to a valid shape, or restore the file from a backup, and after a restart the full session list comes back — both the reporter and the responder verified this.
Read the record id and table name inside the DeepSeek Harness DomainError. It reads stored record '<id>' in table 'workspaces' does not match its schema, and that id is the primary key of the bad record. The ZodError immediately after it gives the field path sessionIds and the expected type, expected array, received string. Together the two lines identify the record and the field.
Because the DeepSeek Harness persistence boundary validates per domain, not per record. parseRecord in storage-domain throws a DomainError for the whole table, so one record that violates the schema prevents the workspace domain from opening; sessionController, schedule, workspaceController, and ui-deliverables all stay pending, and the client only surfaces the first downstream error it hits.
Above all, do not let a script serialize a single-element array into a scalar in DeepSeek Harness. A PowerShell pipeline collapses a one-element result into a scalar, so wrap it explicitly before writing back, or use a serialization option that forces array output. Back up files under storages before rewriting them, because writes that bypass DSH never pass through DSH's pre-write validation.
Related Terms
- DomainError
- DomainError is the error type a DeepSeek Harness storage domain throws on read/write anomalies, carrying the domain name, record id, and table name. Its invalid-record form means a persisted record does not match that domain's schema, and the current implementation fails the whole domain.— https://github.com/deepseek-ai/deepseek-harness/discussions/11612
- parseRecord
- parseRecord is the function in the storage-domain package that parses stored records one by one at the persistence boundary, around lines 200-209 of storage-domain/src/index.ts. It throws a DomainError for records that violate the schema and has no skip-and-continue path.— https://github.com/deepseek-ai/deepseek-harness/discussions/11612
- two-write mutation marker
- The two-write mutation marker is the state bit in storages/workspace.json that records a create or delete operation stopping halfway (spec.ts around lines 36-40). It exists so an interrupted change stays visible on the next start; any logic that skips bad records must preserve this marker or it silently hides a half-applied state.— https://github.com/deepseek-ai/deepseek-harness/discussions/11612
Sources
- #11612 — [Bug] workspace.json with a non-array sessionIds breaks the whole workspace domain and cascades into unrelated services· deepseek-ai (GitHub Discussions)