{"record":{"id":"97ec69144f563008","repo":"paperclipai/paperclip","slug":"git-index-lock-exists-at-indexlockpath","errorCode":null,"errorMessage":"git index lock exists at ${indexLockPath}","messagePattern":"git index lock exists at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/workspace-runtime.ts","lineNumber":1272,"sourceCode":"  }\n\n  const activeService = await findActiveRuntimeServiceBlockingDirtyQuarantine({\n    db: input.db,\n    workspace,\n  });\n  if (!activeService) return;\n\n  input.evidence.safeRepair.eligible = false;\n  input.evidence.safeRepair.reason =\n    `dirty quarantine repair requires runtime service \"${activeService.serviceName}\" (${activeService.id}) to be stopped; current status is ${activeService.status}`;\n  throw branchIncoherenceValidationFailure(input.evidence);\n}\n\nasync function assertGitIndexIsUnlocked(worktreePath: string) {\n  const indexLockPath = await runGit([\"rev-parse\", \"--git-path\", \"index.lock\"], worktreePath)\n    .catch(() => null);\n  if (indexLockPath && existsSync(indexLockPath)) {\n    throw new Error(`git index lock exists at ${indexLockPath}`);\n  }\n}\n\nfunction fingerprintWorkspaceBranchIncoherence(input: {\n  sourceIssueId: string | null;\n  executionWorkspaceId: string | null;\n  worktreePath: string;\n  expectedBranch: string;\n  actualBranch: string | null;\n  cleanliness: GitWorktreeCleanliness;\n  expectedHeadSha: string | null;\n  actualHeadSha: string | null;\n}) {\n  const digest = createHash(\"sha256\")\n    .update(stableStringify({\n      version: 1,\n      reason: GIT_WORKTREE_BRANCH_INCOHERENCE_REASON,\n      sourceIssueId: input.sourceIssueId,","sourceCodeStart":1254,"sourceCodeEnd":1290,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/services/workspace-runtime.ts#L1254-L1290","documentation":"assertGitIndexIsUnlocked found an existing .git/index.lock in the worktree, meaning another git process holds the index. Safe-repair operations refuse to run concurrently with an active git operation to avoid corrupting the index.","triggerScenarios":"Thrown at server/src/services/workspace-runtime.ts:1232 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["A git index lock exists, likely from a crashed git process. Verify no git process is running, then remove the .git/index.lock file and retry."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}