earendil-works/pi · error · MissingSessionCwdError

Stored session working directory does not exist

Error message

Stored session working directory does not exist: ${issue.sessionCwd}${sessionFile}
Current working directory: ${issue.fallbackCwd}

What it means

Thrown by assertSessionCwdExists when the working directory recorded in a session file no longer exists on disk (e.g. the project was moved, renamed, or the drive is unmounted). The message names the stored cwd, the session file it came from, and the process's current cwd used as the fallback.

Solutions

  1. Move or restore the directory referenced by the session's stored cwd, or rename the session file so it is no longer auto-resumed
  2. Resume the session and accept the interactive prompt to continue in the current working directory
  3. Edit the session file's cwd field to point at the directory's new location
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/coding-agent/src/core/session-cwd.ts:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of earendil-works/pi@4af9d21d3b (2026-08-24). Data as JSON: /api/errors/199c96826bd84925. Report an issue: GitHub.

Appendix: source

Thrown at packages/coding-agent/src/core/session-cwd.ts:57

export function formatMissingSessionCwdPrompt(issue: SessionCwdIssue): string {
	return `cwd from session file does not exist\n${issue.sessionCwd}\n\ncontinue in current cwd\n${issue.fallbackCwd}`;
}

export class MissingSessionCwdError extends Error {
	readonly issue: SessionCwdIssue;

	constructor(issue: SessionCwdIssue) {
		super(formatMissingSessionCwdError(issue));
		this.name = "MissingSessionCwdError";
		this.issue = issue;
	}
}

export function assertSessionCwdExists(sessionManager: SessionCwdSource, fallbackCwd: string): void {
	const issue = getMissingSessionCwdIssue(sessionManager, fallbackCwd);
	if (issue) {
		throw new MissingSessionCwdError(issue);
	}
}

View on GitHub (pinned to 4af9d21d3b)