{"record":{"id":"acf685687adeaa9c","repo":"plandex-ai/plandex","slug":"failed-to-rollback-s","errorCode":null,"errorMessage":"failed to rollback: %s","messagePattern":"failed to rollback: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"app/cli/lib/apply.go","lineNumber":814,"sourceCode":"\t\tfor range toRemove {\n\t\t\terr := <-pathsErrCh\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"failed to remove %s: %s\", toRemove, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\terrCh <- nil\n\t}()\n\n\terrs := []error{}\n\tfor i := 0; i < numRoutines; i++ {\n\t\terr := <-errCh\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(\"failed to rollback: %s\", errs)\n\t}\n\tif msg {\n\t\tfmt.Println(\"🚫 Rolled back all changes\")\n\t}\n\treturn nil\n}\n","sourceCodeStart":796,"sourceCodeEnd":821,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/apply.go#L796-L821","documentation":"This is Rollback's aggregate top-level error. Rollback fans out goroutines that revert files, remove files, and prune new project paths, collecting their results from errCh. If any worker reported an error, Rollback returns 'failed to rollback: %s' with all collected errors, after still attempting every worker.","triggerScenarios":"Rollback() is called (directly or via handleApplyScript/execApplyScript) and at least one worker error was received on errCh — e.g. a revert write failed, a removal failed, or GetProjectPaths failed. The message is the aggregation of those child errors.","commonSituations":"Any of the underlying IO problems from errors 110-113; the rolled-back tree was concurrently modified; running without sufficient filesystem permissions; disk issues during a large rollback.","solutions":["Read the appended child errors in the message — they identify which specific revert/remove operation failed.","Fix the specific child error first (permissions, missing dirs, disk space).","Check that no other process is modifying the project tree during rollback.","Re-run Rollback after fixing; it is idempotent for paths that no longer exist if child errors are treated as non-fatal."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check before rollback\nif _, err := os.Stat(fs.ProjectRoot); err != nil {\n\treturn err\n}\n// check writable tree\nfunc writable(dir string) error { f, err := os.CreateTemp(dir, \".chk\"); if err != nil { return err }; os.Remove(f.Name()); return nil }","typeGuard":null,"tryCatchPattern":"if err := Rollback(plan, true); err != nil {\n\tvar aggs []error\n\tfmt.Fprintln(os.Stderr, \"rollback failed:\", err)\n\t// parse child errors, fix root cause, re-run rollback\n}","preventionTips":["Snapshot/backup the tree before applying so rollback is always possible.","Run apply/rollback with the same user that owns the files.","Quiesce other processes touching the project tree.","Fix reported child errors before retrying — the aggregate lists them all."],"tags":["go","rollback","aggregated-errors"],"backgroundTag":"rollback-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}