earendil-works/pi · error · Error
Failed to create forked session
Error message
Failed to create forked session
What it means
Error "Failed to create forked session" thrown in earendil-works/pi.
Source
Thrown at packages/coding-agent/src/core/agent-session-runtime.ts:320
cwd: this.cwd,
agentDir: this.services.agentDir,
sessionManager,
sessionStartEvent: { type: "session_start", reason: "fork", previousSessionFile },
}),
);
await this.finishSessionReplacement(options?.withSession);
return { cancelled: false, selectedText };
}
if (!existsSync(currentSessionFile)) {
throw new Error(
"This session has not been saved yet. Wait for the first assistant response before cloning or forking it.",
);
}
const sessionManager = SessionManager.open(currentSessionFile, sessionDir);
const forkedSessionPath = sessionManager.createBranchedSession(targetLeafId);
if (!forkedSessionPath) {
throw new Error("Failed to create forked session");
}
await this.teardownCurrent("fork", sessionManager.getSessionFile());
this.apply(
await this.createRuntime({
cwd: sessionManager.getCwd(),
agentDir: this.services.agentDir,
sessionManager,
sessionStartEvent: { type: "session_start", reason: "fork", previousSessionFile },
}),
);
await this.finishSessionReplacement(options?.withSession);
return { cancelled: false, selectedText };
}
const sessionManager = this.session.sessionManager;
if (!targetLeafId) {
sessionManager.newSession({ parentSession: this.session.sessionFile });
} else {View on GitHub (pinned to 4af9d21d3b)
When it happens
Trigger: Thrown at packages/coding-agent/src/core/agent-session-runtime.ts:320 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/965c9e7b101f5d05.
Report an issue: GitHub.