plandex-ai/plandex · error

failed to parse input paths: %v

Error message

failed to parse input paths: %v

What it means

This error is produced in a goroutine of MustLoadContext (NamesOnly/directory-tree branch) when ParseInputPaths fails while expanding an input file or directory path into concrete project paths. ParseInputPaths returns errors when fs.IsSubpathOf fails while matching project paths against the input, or when a directory input is encountered without --recursive/-r, --tree, or --map. The CLI wraps the underlying cause with 'failed to parse input paths: %v' and sends it on errCh.

Source

Thrown at app/cli/lib/context_load.go:255

					composite := strings.Join([]string{string(shared.ContextDirectoryTreeType), inputFilePath}, "|")
					if existsByComposite[composite] != nil {
						alreadyLoadedByComposite[composite] = existsByComposite[composite]
						continue
					}

					numRoutines++
					go func(inputFilePath string) {
						sem <- struct{}{}
						defer func() { <-sem }()

						flattenedPaths, err := ParseInputPaths(ParseInputPathsParams{
							FileOrDirPaths: []string{inputFilePath},
							BaseDir:        baseDir,
							ProjectPaths:   paths,
							LoadParams:     params,
						})
						if err != nil {
							errCh <- fmt.Errorf("failed to parse input paths: %v", err)
							return
						}

						if !params.ForceSkipIgnore {
							var filteredPaths []string
							for _, path := range flattenedPaths {
								if _, ok := paths.ActivePaths[path]; ok {
									filteredPaths = append(filteredPaths, path)
								} else {
									ignored, reason, err := fs.IsIgnored(paths, path, baseDir)
									if err != nil {
										errCh <- fmt.Errorf("failed to check if %s is ignored: %v", path, err)
										return
									}
									if ignored {
										ignoredPaths[path] = reason
									}
								}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Re-run with a directory-expansion flag: --recursive/-r for full loads or --tree for the NamesOnly path that hit this error.
  2. Load individual files instead of directories if recursion was not intended.
  3. Verify the input path exists and resolves correctly from the project root (no broken symlinks, correct relative path).
  4. Check the wrapped message after the prefix; if it mentions 'subpath of', inspect the project dir structure and baseDir for anomalies (e.g. path outside the repo).

Example fix

// before
plandex load ./src
// error: failed to parse input paths: cannot process directory ./src: requires --recursive/-r, --tree, or --map flag
// after
plandex load ./src --recursive   # or: plandex load ./src --tree
Defensive patterns

Strategy: validation

Validate before calling

info, err := os.Stat(inputPath)
if err != nil {
    return fmt.Errorf("input path %s is not accessible: %w", inputPath, err)
}
if info.IsDir() && !loadParams.Recursive && !loadParams.NamesOnly && !loadParams.DefsOnly {
    return fmt.Errorf("%s is a directory; pass --recursive/-r, --tree, or --map", inputPath)
}

Type guard

func isDirWithoutExpansionFlag(path string, params *types.LoadContextParams) bool {
    info, err := os.Stat(path)
    return err == nil && info.IsDir() && !params.Recursive && !params.NamesOnly && !params.DefsOnly
}

Prevention

When it happens

Trigger: Running context load with --tree (NamesOnly) where (1) an input path is a directory and no recursive/tree/map flag allowed it (ParseInputPaths returns 'cannot process directory %s: requires --recursive/-r, --tree, or --map flag'), or (2) fs.IsSubpathOf errors while checking whether a project path falls under the input path.

Common situations: Typing 'plandex load src' without -r/--tree/--map and expecting directory loading; passing a directory in an alias/script that previously used a file; broken or symlinked paths causing IsSubpathOf resolution failures.

Understand the failure class

Related errors


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