ChatGPTClaudeGrok / X / CursorGemini

DeepSeek Harness Workspaces Gone: workspace.json sessionIds

TroubleshootingPublished 2026-11-03Author: DeepSeek Plugin Market
DeepSeek Harnessworkspace domainsessionIdsDomainErrorZodErrordata not lost
DeepSeek Harness workspaces go blank and sessions look gone: a workspace.json sessionIds written as a string breaks the whole domain. Field-level repair.

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.

  1. Look at whether the session files still exist. Sessions persist under ~/.dsh/storages/sessions/ (%USERPROFILE%\.dsh\storages\sessions\ on Windows, or the corresponding directory when DSH_HOME is redirected). Expected: the file count matches the session count and sizes look normal. Files present = data not lost.

  2. 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.

  3. Compare against the "entries that did not activate" count in the startup log. Expected: a line like warning: 5 entries did not activate followed by a DomainError. That number tells you how many services are stuck in pending because 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.

  1. Grab the DomainError line from the startup log.
text
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-….

  1. Grab the ZodError field path right after it.
text
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.

  1. Find that record in workspace.json by its id.
bash
# 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.

  1. 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.

  1. 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.
  2. Change only the shape of sessionIds and leave every other field alone. Turn "sessionIds": "session-7f2c108b-…" into "sessionIds": ["session-7f2c108b-…"], which is just wrapping the value in brackets.
  3. 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.
  4. Restart dsh web. Expected: no more DomainError for domain 'workspace', the entries did not activate count drops or disappears, and the workspace list returns.
  5. 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.

  1. The schema declares an array. packages/workspace/workspace/src/spec.ts:29 declares sessionIds: z.array(sessionId). That is the single source of truth, and a string can never match it.
  2. The persistence boundary throws per domain. parseRecord at packages/storage/storage-domain/src/index.ts:200-209 throws DomainError('invalid-record', ...) while parsing records and has no skip branch. So one bad record equals an entire workspace domain that fails to open.
  3. Dependent services all go pending. The responder lists sessionController, schedule, workspaceController, and ui-deliverables as affected. They never see the domain ready, so their initialization hangs.
  4. 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.
  5. Version consistency shows this is not a one-release quirk. The responder checked that the spec.ts schema and parseRecord are identical across rc.2, rc.5, and master ce7073d5. 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.

  1. 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-…".
  2. Nothing validates on write-back. The script overwrites workspace.json directly; DSH neither knows about the write nor gets a chance to intercept it.
  3. The read side discovers it only on the next start. parseRecord notices 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".
  4. How to reduce the risk: wrap arrays explicitly before a script writes JSON; on PowerShell 7 use ConvertTo-Json -AsArray to force array output; validate with a JSON parser before persisting. Also note that the log once showed default data dir not writable and fell back to Desktop\HarnessData; the fallback itself is unrelated to corruption, but it puts storages/ 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.

  1. Where the marker lives: the two-write mutation marker at spec.ts:36-40 records a create or delete that stopped halfway; "skip per record plus startup self-healing" must not throw the record away together with its marker.
  2. 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.
  3. 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 DomainError and ZodError lines plus the entries did not activate count.

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.

  1. Prove the data still exists before touching anything; sessions on disk are not lost data.
  2. DomainError is the root cause and directoryPickerController is unavailable is the symptom; never read them in reverse.
  3. Change only the shape of the bad field — do not reorder the JSON, do not change ids, do not touch the two-write marker.
  4. Always back up first; hand-editing storage files has no rollback other than a backup.
  5. Do not expect a version change to fix it: the schema and parseRecord are the same on rc.2, rc.5, and master, so switching releases changes nothing.
  6. Confirm through the startup log afterwards: the DomainError is gone and the pending count dropped, and only then is it really fixed.

Source: Discussion #11612.

ChatGPTClaudeGrok / X / CursorGemini

FAQ

DeepSeek Harness workspaces gone on start — sessions lost?

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.

DeepSeek Harness workspace DomainError: which line to read?

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.

Why does one bad record hide DeepSeek Harness workspaces?

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.

How do I stop corruption of DeepSeek Harness workspace.json?

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