{"record":{"id":"90ea003092fdd09f","repo":"paperclipai/paperclip","slug":"workspace-restore-left-staged-git-index-changes-af","errorCode":null,"errorMessage":"Workspace restore left staged git index changes after reset:\\n${stagedDiff.stdout.trim()}","messagePattern":"Workspace restore left staged git index changes after reset:\\\\n(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/adapter-utils/src/git-workspace-sync.ts","lineNumber":690,"sourceCode":"  remoteDir: string;\n  baseSha: string;\n  exportRef: string;\n  bundlePath: string;\n  statusPath?: string;\n  catBundle?: boolean;\n  cleanupBundle?: boolean;\n  /**\n   * Skip the delta boundary entirely and always emit a full, self-contained\n   * bundle (no prerequisites). Used as the recovery path when a delta import\n   * failed because the host lacked the bundle's prerequisite.\n   */\n  forceFullBundle?: boolean;\n}): string {\n  const remoteDir = shellQuote(input.remoteDir);\n  const bundlePath = shellQuote(input.bundlePath);\n  const exportRef = shellQuote(input.exportRef);\n  const baseSha = shellQuote(input.baseSha);\n  const statusPath = input.statusPath ? shellQuote(input.statusPath) : null;\n  const cleanupParts = [\n    `rm -f ${bundlePath}`,\n    ...(statusPath ? [`rm -f ${statusPath}`] : []),\n    `git -C ${remoteDir} update-ref -d ${exportRef} >/dev/null 2>&1 || true`,\n  ];\n  return [\n    \"set -e\",\n    input.cleanupBundle ? `cleanup() { ${cleanupParts.join(\"; \")}; }` : \"\",\n    input.cleanupBundle ? \"trap cleanup EXIT\" : \"\",\n    `mkdir -p ${shellQuote(path.posix.dirname(input.bundlePath))}`,\n    `rm -f ${bundlePath}`,\n    // Choose the bundle boundary. A thin bundle `HEAD --not <baseSha>` records\n    // baseSha as a prerequisite the importer (host) must already hold. That\n    // assumption breaks in two real cases, and then `git fetch` on the host\n    // hard-fails with \"did not send all necessary objects\" and the run's work\n    // is lost:\n    //   1. The sandbox HEAD has diverged from baseSha (e.g. a local-only branch\n    //      that forked from an older commit) — the host may still hold baseSha,","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/adapter-utils/src/git-workspace-sync.ts#L672-L708","documentation":"After resetting the index, 'git diff --cached' still reports staged changes, so the restore left the index dirty relative to HEAD; a post-condition consistency guard.","triggerScenarios":"Thrown at packages/adapter-utils/src/git-workspace-sync.ts:626 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `git reset` in the workspace to unstage the listed changes, then retry the restore."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}