can1357/oh-my-pi · error · ToolError
No active checkpoint. Create a checkpoint before calling rew
Error message
No active checkpoint. Create a checkpoint before calling rewind.
What it means
The rewind tool requires an active checkpoint to rewind to. If session.getCheckpointState() returns nothing and no rewind has previously completed, there is no snapshot to restore, so the tool throws immediately. A checkpoint tool call must precede any rewind in the session.
Source
Thrown at packages/coding-agent/src/tools/checkpoint.ts:121
static createIf(session: ToolSession): RewindTool | null {
return new RewindTool(session);
}
async execute(
_toolCallId: string,
params: RewindParams,
_signal?: AbortSignal,
_onUpdate?: AgentToolUpdateCallback<RewindToolDetails>,
_context?: AgentToolContext,
): Promise<AgentToolResult<RewindToolDetails>> {
if (!this.session.getCheckpointState?.()) {
if (this.session.getLastCompletedRewind?.()) {
throw new ToolError(
"Checkpoint already completed; continue from the retained rewind report instead of calling rewind again.",
);
}
throw new ToolError("No active checkpoint. Create a checkpoint before calling rewind.");
}
const report = params.report.trim();
if (report.length === 0) {
throw new ToolError("Report cannot be empty.");
}
return toolResult<RewindToolDetails>({ report, rewound: true })
.text(["Rewind requested.", "Report captured for context replacement."].join("\n"))
.done();
}
}
View on GitHub (pinned to 9690622007)
Solutions
- Call the checkpoint tool first to create a snapshot, then call rewind.
- Verify checkpoint state exists with session.getCheckpointState() before scheduling a rewind.
- If state was expected, check whether the session was recreated or checkpoint state failed to persist.
Example fix
// before
await session.tools.rewind({ report: "restore files" });
// after
if (!session.getCheckpointState?.()) {
await session.tools.checkpoint();
}
await session.tools.rewind({ report: "restore files" }); Defensive patterns
Strategy: validation
Validate before calling
if (!session.getCheckpointState?.()) {
await session.tools.checkpoint(); // create snapshot first
} Try / catch
try {
await rewindTool.execute(params, ...);
} catch (err) {
if (err instanceof ToolError && /No active checkpoint/.test(err.message)) {
await session.tools.checkpoint();
await rewindTool.execute(params, ...); // retry once after checkpointing
} else throw err;
} Prevention
- Always pair checkpoint → rewind in workflow code.
- Assert checkpoint state exists in tests before exercising rewind.
- Persist/restore checkpoint state across session restarts if rewinds must survive restarts.
When it happens
Trigger: Calling the rewind tool's execute() before any checkpoint tool call was made, or after the checkpoint state was never initialized in the session.
Common situations: An agent emits the rewind tool call without first emitting checkpoint; a session was restarted and checkpoint state was not persisted; a test or script invokes rewind directly on a fresh ToolSession.
Related errors
- Checkpoint already completed; continue from the retained rew
- ${error.message} (rethrown as ToolError from StructuredSubag
- \`${name}\` cannot run through the eval bridge; call the dir
- Plan mode is not active.
- Unsupported internal URL in bash command: ${url}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/d3601835fdffb27d.
Report an issue: GitHub.