paperclipai/paperclip · error
Refusing terminal workspace cleanup because the git status c
Error message
Refusing terminal workspace cleanup because the git status could not be verified
What it means
Fail-closed safety check in assertTerminalCleanupGitStateUnchanged: re-inspecting the worktree (inspectGitCloseReadiness) failed (statusInspectionSucceeded false), so the current git status could not be verified against the state recorded at delivery verification. Terminal cleanup of an unverifiable worktree is refused.
Source
Thrown at server/src/services/execution-workspaces.ts:1455
}
async function assertTerminalCleanupGitStateUnchanged(
workspace: ExecutionWorkspaceRow,
expectedHeadSha: string | null,
) {
if (workspace.providerType !== "git_worktree") return;
const workspacePath = readNullableString(workspace.providerRef) ?? readNullableString(workspace.cwd);
if (!workspacePath || !expectedHeadSha) {
throw new Error("Refusing terminal workspace cleanup because the expected git HEAD is unknown");
}
const [current, currentHeadSha, currentBranchName] = await Promise.all([
inspectGitCloseReadiness(toExecutionWorkspace(workspace)),
readGitStdout(["rev-parse", "HEAD"], workspacePath).catch(() => null),
readGitStdout(["symbolic-ref", "--quiet", "--short", "HEAD"], workspacePath).catch(() => null),
]);
if (!current.statusInspectionSucceeded) {
throw new Error("Refusing terminal workspace cleanup because the git status could not be verified");
}
if (
!current.git?.repoRoot
|| current.git.hasDirtyTrackedFiles
|| current.git.hasUntrackedFiles
|| currentHeadSha !== expectedHeadSha
|| (workspace.branchName && currentBranchName !== workspace.branchName)
) {
throw new Error("Refusing terminal workspace cleanup because the git worktree changed after delivery was verified");
}
}
async function hydrateWorkspace(row: ExecutionWorkspaceRow, runtimeServices: WorkspaceRuntimeService[] = []) {
const workspace = toExecutionWorkspace(row, runtimeServices);
const { git } = await inspectGitCloseReadiness(workspace);
const assessment = await assessDelivery(row, git);
return toExecutionWorkspace(row, runtimeServices, assessment.deliveryState);
}View on GitHub (pinned to a7e689b3c3)
Solutions
- Verify git is available and the worktree is readable so status can be checked, then retry cleanup.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/services/execution-workspaces.ts:1455 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18).
Data as JSON: /api/errors/85b5053c0d4b2bc7.
Report an issue: GitHub.