{"record":{"id":"f879aa1667c31c86","repo":"deepseek-ai/deepseek-harness","slug":"cannot-attach-session-sessionid-to-workspace","errorCode":null,"errorMessage":"cannot attach session '${sessionId}' to workspace '${this.record.path}': its stored header carries no cwd to validate against","messagePattern":"cannot attach session '(.+?)' to workspace '(.+?)': its stored header carries no cwd to validate against","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/workspace/workspace/src/entity.ts","lineNumber":117,"sourceCode":"  }\n\n  get sessionIds(): readonly SessionId[] {\n    return this.record.sessionIds.filter(id => this.host.sessionPath(id) === this.record.path)\n  }\n\n  async setTitle(title: string): Promise<void> {\n    await this.mutate(record => ({ ...record, title }))\n  }\n\n  async attachSession(sessionId: SessionId): Promise<void> {\n    // Validation is skipped when the settled snapshot already accounts the\n    // id: the cwd fact was checked when it first attached and both inputs\n    // (stored header cwd, workspace path) are immutable. Membership itself is\n    // decided on the write chain inside `mutate`, never on this snapshot.\n    if (!this.record.sessionIds.includes(sessionId)) {\n      const header = await this.host.readSessionHeader(sessionId)\n      if (header.cwd === undefined) {\n        throw new Error(\n          `cannot attach session '${sessionId}' to workspace '${this.record.path}': `\n          + 'its stored header carries no cwd to validate against',\n        )\n      }\n      let cwd: string\n      try {\n        cwd = await realpathNormalize(header.cwd)\n      } catch (error) {\n        throw new Error(\n          `cannot attach session '${sessionId}' to workspace '${this.record.path}': `\n          + `its cwd '${header.cwd}' does not resolve, so it cannot be validated`,\n          { cause: error },\n        )\n      }\n      if (!(await stat(cwd)).isDirectory()) {\n        throw new Error(\n          `cannot attach session '${sessionId}' to workspace '${this.record.path}': `\n          + `its cwd '${header.cwd}' is not a directory`,","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/workspace/workspace/src/entity.ts#L99-L135","documentation":"Error \"cannot attach session '${sessionId}' to workspace '${this.record.path}': its stored header carries no cwd to validate against\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/workspace/workspace/src/entity.ts:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-create the session so its stored header records a cwd, or repair the persisted session header before attaching it to a workspace."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}