{"record":{"id":"4a1407851f7bdd5d","repo":"plandex-ai/plandex","slug":"failed-to-get-project-paths-v","errorCode":null,"errorMessage":"failed to get project paths: %v","messagePattern":"failed to get project paths: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/apply.go","lineNumber":781,"sourceCode":"\t\t}(path, revert)\n\t}\n\n\tfor _, path := range rollbackPlan.ToRemove {\n\t\tgo func(path string) {\n\t\t\terr := os.Remove(path)\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"failed to remove %s: %s\", path, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t\terrCh <- nil\n\t\t}(path)\n\t}\n\n\tgo func() {\n\t\tvar err error\n\t\tupdatedProjectPaths, err := fs.GetProjectPaths(fs.ProjectRoot)\n\t\tif err != nil {\n\t\t\terrCh <- fmt.Errorf(\"failed to get project paths: %v\", err)\n\t\t}\n\t\tvar toRemove []string\n\t\tfor path := range updatedProjectPaths.AllPaths {\n\t\t\tif _, ok := rollbackPlan.PreviousProjectPaths.AllPaths[path]; !ok {\n\t\t\t\ttoRemove = append(toRemove, path)\n\t\t\t}\n\t\t}\n\t\tpathsErrCh := make(chan error, len(toRemove))\n\t\tfor _, path := range toRemove {\n\t\t\tgo func(path string) {\n\t\t\t\terr := os.Remove(path)\n\t\t\t\tpathsErrCh <- err\n\t\t\t}(path)\n\t\t}\n\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())","sourceCodeStart":763,"sourceCodeEnd":799,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/apply.go#L763-L799","documentation":"Inside Rollback, a dedicated goroutine re-reads the project's path set via fs.GetProjectPaths(fs.ProjectRoot) so it can compute which paths are new (not present in rollbackPlan.PreviousProjectPaths) and remove them. If GetProjectPaths fails, this error wraps the failure and is sent to the error channel.","triggerScenarios":"fs.GetProjectPaths(fs.ProjectRoot) returns a non-nil error during rollback — typically because ProjectRoot does not exist, is unreadable, or the underlying path walk (e.g. filepath.WalkDir) hits a permission or IO error.","commonSituations":"The project root directory was deleted or renamed before rollback; ProjectRoot is configured incorrectly (bad path in config); walking the tree encounters unreadable subdirectories; running from a different working directory with a stale ProjectRoot.","solutions":["Verify ProjectRoot points to an existing, readable directory before calling Rollback (os.Stat the path).","Fix the project root configuration if it references a stale path.","Check walk permissions on all subdirectories of ProjectRoot.","If the root legitimately no longer exists, treat removal of remaining new paths as unnecessary and skip the GetProjectPaths step."],"exampleFix":"// before\nupdatedProjectPaths, err := fs.GetProjectPaths(fs.ProjectRoot)\nif err != nil {\n\terrCh <- fmt.Errorf(\"failed to get project paths: %v\", err)\n}\n// after\nif _, statErr := os.Stat(fs.ProjectRoot); statErr != nil {\n\terrCh <- nil // root gone, nothing new to remove\n\treturn\n}\nupdatedProjectPaths, err := fs.GetProjectPaths(fs.ProjectRoot)\nif err != nil {\n\terrCh <- fmt.Errorf(\"failed to get project paths: %v\", err)\n\treturn\n}","handlingStrategy":"validation","validationCode":"if st, err := os.Stat(fs.ProjectRoot); err != nil || !st.IsDir() {\n\t// root missing: nothing to prune, skip GetProjectPaths\n}\nfunc dirReadable(p string) error {\n\tf, err := os.Open(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn f.Close()\n}","typeGuard":null,"tryCatchPattern":"err := Rollback(plan, true)\nif err != nil && strings.Contains(err.Error(), \"failed to get project paths\") {\n\t// verify/fix ProjectRoot then retry rollback\n}","preventionTips":["Stat ProjectRoot before invoking rollback.","Keep ProjectRoot config in sync with the actual checkout location.","Ensure walk permissions on all subdirectories.","Skip the new-path pruning step when the root legitimately no longer exists."],"tags":["go","filesystem","rollback","project-paths"],"backgroundTag":"project-root-unreadable","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}