{"record":{"id":"782fdc6c326a3e81","repo":"paperclipai/paperclip","slug":"safety-checks-failed-resolve-the-issues-above-or","errorCode":null,"errorMessage":"Safety checks failed. Resolve the issues above or re-run with --force.","messagePattern":"Safety checks failed\\. Resolve the issues above or re-run with --force\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":2917,"sourceCode":"    } else {\n      problems.push(\n        `Branch \"${name}\" has commits not found on any other branch or remote. ` +\n          `Deleting it will lose work. Push it first, or use --force.`,\n      );\n    }\n  }\n\n  if (hasTargetDir && worktreePathHasUncommittedChanges(targetPath)) {\n    problems.push(\n      `Worktree directory ${targetPath} has uncommitted changes. Commit or stash first, or use --force.`,\n    );\n  }\n\n  if (problems.length > 0 && !opts.force) {\n    for (const problem of problems) {\n      p.log.error(problem);\n    }\n    throw new Error(\"Safety checks failed. Resolve the issues above or re-run with --force.\");\n  }\n  if (problems.length > 0 && opts.force) {\n    for (const problem of problems) {\n      p.log.warning(`Overridden by --force: ${problem}`);\n    }\n  }\n\n  // ── 3. Clean up (idempotent steps) ──────────────────────────────────\n\n  // 3a. Remove the git worktree registration\n  if (linkedWorktree) {\n    const worktreeDirExists = existsSync(linkedWorktree.worktree);\n    const spinner = p.spinner();\n    if (worktreeDirExists) {\n      spinner.start(`Removing git worktree at ${linkedWorktree.worktree}...`);\n      try {\n        const removeArgs = [\"worktree\", \"remove\", linkedWorktree.worktree];\n        if (opts.force) removeArgs.push(\"--force\");","sourceCodeStart":2899,"sourceCodeEnd":2935,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L2899-L2935","documentation":"Destructive-action protection in worktree removal: pre-flight checks found unpushed commits or uncommitted changes that would be lost by deleting the worktree/branch, and --force was not passed, so the delete aborts after listing each problem.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:2102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Resolve the listed safety issues and retry.","Re-run with --force to bypass the safety checks."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}