{"record":{"id":"684b4228078e975a","repo":"plandex-ai/plandex","slug":"error-walking-directory-s","errorCode":null,"errorMessage":"error walking directory: %s","messagePattern":"error walking directory: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/fs/paths.go","lineNumber":266,"sourceCode":"\n\t\t\t\t\tif !isGitRepo {\n\t\t\t\t\t\tmu.Lock()\n\t\t\t\t\t\tdefer mu.Unlock()\n\t\t\t\t\t\tactivePaths[relPath] = true\n\n\t\t\t\t\t\tparentDir := relPath\n\t\t\t\t\t\tfor parentDir != \".\" && parentDir != \"/\" && parentDir != \"\" {\n\t\t\t\t\t\t\tparentDir = filepath.Dir(parentDir)\n\t\t\t\t\t\t\tactiveDirs[parentDir] = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error walking directory: %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\terrCh <- nil\n\t\t}()\n\t}\n\n\tfor i := 0; i < numRoutines; i++ {\n\t\terr := <-errCh\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tfor dir := range activeDirs {\n\t\tallDirs[dir] = true\n\t}\n","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/fs/paths.go#L248-L284","documentation":"When baseDir is NOT a git repo, GetPaths enumerates files with filepath.Walk. The walk callback returns any error it encounters (unreadable directory, filepath.Rel failure, etc.), and this error wraps the Walk result. It is thrown when the directory walk fails for any reason, so the caller gets no ProjectPaths result.","triggerScenarios":"Calling GetPaths on a non-git directory containing unreadable subdirectories (permission denied), a symlink loop or disappearing entry mid-walk (race), or a directory deleted during the walk; also an inner filepath.Rel failure inside the callback (cross-drive paths on Windows).","commonSituations":"Scanning directories with restricted permissions (other users' home dirs, protected system dirs); walking network mounts that drop files mid-scan; projects under paths with permission errors after OS updates; race conditions where files are removed while the scan runs.","solutions":["Check permissions on the project directory and its subdirectories (`ls -laR` or `find <dir> -not -readable`) and restore read access.","Read the wrapped error in the message (%s) to identify the exact file that failed and fix that specific entry (chmod, delete, or ignore).","Ensure the directory isn't being modified concurrently (stop editors/build tools or rescan on a stable tree).","If walking a network mount fails, copy or mount the project locally before scanning.","Confirm the working directory is a normal project directory, not a protected or system path."],"exampleFix":"// before (shell)\n$ plandex load\nerror walking directory: open /project/secret: permission denied\n// after (shell)\n$ chmod u+rx /project/secret\n$ plandex load","handlingStrategy":"try-catch","validationCode":"if _, err := os.ReadDir(baseDir); err != nil {\n\treturn fmt.Errorf(\"cannot read directory %s: %w\", baseDir, err)\n}\n// optionally probe readability of subdirs\nfilepath.WalkDir(baseDir, func(p string, d os.DirEntry, err error) error {\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unreadable entry %s: %w\", p, err)\n\t}\n\treturn nil\n})","typeGuard":null,"tryCatchPattern":"if err := <-errCh; err != nil {\n\tvar permErr *os.PathError\n\tif errors.As(err, &permErr) && os.IsPermission(permErr) {\n\t\t// chmod / skip that path and retry\n\t}\n}","preventionTips":["Ensure the project directory tree is readable by the user running the tool","Read the wrapped error to identify and fix the exact offending path","Avoid scanning directories being concurrently modified or deleted","Work on a local copy when dealing with flaky network mounts","Skip known-problematic directories (add them to .plandexignore) when possible"],"tags":["go","filesystem","permissions","walk"],"backgroundTag":"directory-walk-permission-denied","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"}