plandex-ai/plandex · error

failed to get the directory tree %s: %v

Error message

failed to get the directory tree %s: %v

What it means

Same family as the directory-tree failure, but raised in a second code path that loads the tree recursively (LoadParams{Recursive:true}) with explicit projectPaths. ParseInputPaths returned an error while re-expanding a project directory-tree context. It indicates the recursive load of the tree root failed.

Source

Thrown at app/cli/lib/context_update.go:607

				// We collect paths from the existing map
				var mapPaths []string
				for path := range ctx.MapShas {
					mapPaths = append(mapPaths, path)
				}

				// Next, see if there are newly added files
				baseDir := fs.GetBaseDirForFilePaths([]string{ctx.FilePath})
				flattenedPaths, err := ParseInputPaths(ParseInputPathsParams{
					FileOrDirPaths: []string{ctx.FilePath},
					BaseDir:        baseDir,
					ProjectPaths:   projectPaths,
					LoadParams:     &types.LoadContextParams{Recursive: true},
				})
				if err != nil {
					mu.Lock()
					defer mu.Unlock()
					errs = append(errs, fmt.Errorf("failed to get the directory tree %s: %v", ctx.FilePath, err))
					return
				}

				var filtered []string
				if projectPaths != nil {
					for _, p := range flattenedPaths {
						if _, ok := projectPaths.ActivePaths[p]; ok {
							filtered = append(filtered, p)
						}
					}
					flattenedPaths = filtered
				}

				// If a path was not already in the map, it's newly added
				for _, p := range flattenedPaths {
					if _, ok := ctx.MapShas[p]; !ok {
						mapPaths = append(mapPaths, p)
					}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped %v cause and fix the specific path/permission/ignore problem it names.
  2. Correct the project paths configuration so all referenced dirs are valid and readable.
  3. Remove and re-add the project tree context so it rebuilds against current paths.
  4. Resolve symlink loops or exclude problematic directories via ignore rules.
Defensive patterns

Strategy: validation

Validate before calling

for _, dir := range projectDirs {
    if fi, err := os.Stat(dir); err != nil || !fi.IsDir() {
        return fmt.Errorf("project path %s invalid: %v", dir, err)
    }
}

Prevention

When it happens

Trigger: ParseInputPaths with FileOrDirPaths [ctx.FilePath], ProjectPaths set, and LoadParams{Recursive:true} returns err during the project-tree goroutine — recursive traversal, ignore evaluation, or path resolution failed.

Common situations: Project root reconfigured to a path with unreadable subdirectories; ignore-file syntax errors newly introduced; recursive scan hitting a very deep symlink cycle; tree root deleted or renamed after context creation but before stat notice.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/8f3b8d53ae8d6d19. Report an issue: GitHub.