deepseek-ai/deepseek-harness · error · Error
cannot attach session
Error message
cannot attach session '${sessionId}' to workspace '${this.record.path}': its stored header carries no cwd to validate against What it means
Attachment precondition in the workspace entity: the stored session header has no cwd, so workspace membership (path == resolved cwd) cannot be validated for this attach. Sessions without a recorded cwd cannot be attached to a workspace.
Solutions
- Re-create the session so its stored header records a cwd, or repair the persisted session header before attaching it to a workspace.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/workspace/workspace/src/entity.ts:117 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/f879aa1667c31c86.
Report an issue: GitHub.
Appendix: source
Thrown at packages/workspace/workspace/src/entity.ts:117
}
get sessionIds(): readonly SessionId[] {
return this.record.sessionIds.filter(id => this.host.sessionPath(id) === this.record.path)
}
async setTitle(title: string): Promise<void> {
await this.mutate(record => ({ ...record, title }))
}
async attachSession(sessionId: SessionId): Promise<void> {
// Validation is skipped when the settled snapshot already accounts the
// id: the cwd fact was checked when it first attached and both inputs
// (stored header cwd, workspace path) are immutable. Membership itself is
// decided on the write chain inside `mutate`, never on this snapshot.
if (!this.record.sessionIds.includes(sessionId)) {
const header = await this.host.readSessionHeader(sessionId)
if (header.cwd === undefined) {
throw new Error(
`cannot attach session '${sessionId}' to workspace '${this.record.path}': `
+ 'its stored header carries no cwd to validate against',
)
}
let cwd: string
try {
cwd = await realpathNormalize(header.cwd)
} catch (error) {
throw new Error(
`cannot attach session '${sessionId}' to workspace '${this.record.path}': `
+ `its cwd '${header.cwd}' does not resolve, so it cannot be validated`,
{ cause: error },
)
}
if (!(await stat(cwd)).isDirectory()) {
throw new Error(
`cannot attach session '${sessionId}' to workspace '${this.record.path}': `
+ `its cwd '${header.cwd}' is not a directory`,View on GitHub (pinned to b150a551b8)