{"record":{"id":"5a53c9bb4674f030","repo":"plandex-ai/plandex","slug":"failed-to-get-directory-tree-s-v","errorCode":null,"errorMessage":"failed to get directory tree %s: %v","messagePattern":"failed to get directory tree (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_update.go","lineNumber":508,"sourceCode":"\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tbaseDir := fs.GetBaseDirForFilePaths([]string{ctx.FilePath})\n\t\t\t\tflattenedPaths, err := ParseInputPaths(ParseInputPathsParams{\n\t\t\t\t\tFileOrDirPaths: []string{ctx.FilePath},\n\t\t\t\t\tBaseDir:        baseDir,\n\t\t\t\t\tProjectPaths:   paths,\n\t\t\t\t\tLoadParams: &types.LoadContextParams{\n\t\t\t\t\t\tNamesOnly:       true,\n\t\t\t\t\t\tForceSkipIgnore: ctx.ForceSkipIgnore,\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tmu.Lock()\n\t\t\t\t\tdefer mu.Unlock()\n\n\t\t\t\t\terrs = append(errs, fmt.Errorf(\"failed to get directory tree %s: %v\", ctx.FilePath, err))\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif !ctx.ForceSkipIgnore && paths != nil {\n\t\t\t\t\tvar filtered []string\n\t\t\t\t\tfor _, p := range flattenedPaths {\n\t\t\t\t\t\tif _, ok := paths.ActivePaths[p]; ok {\n\t\t\t\t\t\t\tfiltered = append(filtered, p)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tflattenedPaths = filtered\n\t\t\t\t}\n\n\t\t\t\t// Partial skipping for sub-paths\n\t\t\t\tvar kept []string\n\t\t\t\tmu.Lock()\n\t\t\t\tfor _, p := range flattenedPaths {\n\t\t\t\t\tlineSize := int64(len(p))","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_update.go#L490-L526","documentation":"Produced when ParseInputPaths fails while recomputing a directory-tree context. The library walks the tree directory to enumerate files (names-only mode) and wraps any walk/parse failure with the tree's root path. The tree root still exists (the prior IsNotExist check passed), so the failure is inside path parsing, ignore-rule handling, or permission on subdirectories.","triggerScenarios":"ParseInputPathsParams{NamesOnly:true, ForceSkipIgnore:...} returns err for ctx.FilePath during the directory-tree goroutine — e.g. unreadable subdirectory, symlink loop, or invalid ignore patterns under the tree.","commonSituations":"A subdirectory of the tree was made inaccessible (chmod 000) or deleted mid-walk; malformed .gitignore/ignore rules; symlink cycles causing walk errors; project paths config referencing invalid globs.","solutions":["Inspect the wrapped %v error; restore read/execute permissions on the offending subdirectory.","Fix or remove malformed ignore patterns (.gitignore or project ignore config) under the tree root.","Remove broken symlinks or symlink loops inside the tree.","If the tree root is stale, remove and re-add the directory-tree context."],"exampleFix":"// before\ndrwx------ private/   # inside tree root, walk fails\n// after\nchmod o+rx private/    # or exclude it via ignore rules","handlingStrategy":"validation","validationCode":"err := filepath.WalkDir(treeRoot, func(p string, d fs.DirEntry, err error) error {\n    if err != nil { return fmt.Errorf(\"unreadable under %s: %w\", p, err) }\n    return nil\n})\nif err != nil { return err } // fix perms/symlinks before refreshing the tree context","typeGuard":null,"tryCatchPattern":"if err := refreshTreeCtx(ctx); err != nil {\n    if strings.Contains(err.Error(), \"failed to get directory tree\") {\n        // inspect wrapped cause: perms, ignore rules, symlinks\n    }\n}","preventionTips":["Keep all subdirectories of tree roots readable (o+rx)","Lint .gitignore/ignore files for syntax errors","Avoid symlink loops inside tree roots","Re-add tree contexts after moving their roots"],"tags":["filesystem","directory-tree","walk"],"backgroundTag":"directory-walk-failed","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"}