plandex-ai/plandex · error

failed to get project paths: %v

Error message

failed to get project paths: %v

What it means

MustLoadContext derives a base directory from the input file paths and calls fs.GetProjectPaths to enumerate project paths (respecting .gitignore etc.); this error means that local filesystem walk failed. It happens before any server calls for those paths, so it's purely a local project-root/ignore-file problem.

Source

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

				for _, path := range toLoadMapPaths {
					if !cachedMapPaths[path] {
						uncachedMapPaths = append(uncachedMapPaths, path)
					}
				}
			} else {
				uncachedMapPaths = toLoadMapPaths
			}

			toLoadMapPaths = uncachedMapPaths
			inputFilePaths = toLoadMapPaths
		}

		if len(inputFilePaths) > 0 {
			baseDir := fs.GetBaseDirForFilePaths(inputFilePaths)

			paths, err := fs.GetProjectPaths(baseDir)
			if err != nil {
				onErr(fmt.Errorf("failed to get project paths: %v", err))
			}

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

View on GitHub (pinned to e2d772072e)

Solutions

  1. Run from the project root or pass paths relative to it and confirm the directory exists
  2. Fix or remove malformed .gitignore/.plandexignore files
  3. Check read permissions on the base directory (ls -la)
  4. Re-run with --skip-ignore/-f if ignore-file parsing is the blocker

Example fix

// before
paths, err := fs.GetProjectPaths(baseDir)
if err != nil {
	onErr(fmt.Errorf("failed to get project paths: %v", err))
}
// after
if _, statErr := os.Stat(baseDir); statErr != nil {
	onErr(fmt.Errorf("project directory %s not accessible: %v", baseDir, statErr))
}
paths, err := fs.GetProjectPaths(baseDir)
if err != nil {
	onErr(fmt.Errorf("failed to get project paths: %w", err))
}
Defensive patterns

Strategy: validation

Validate before calling

// validate the base dir before enumerating paths
baseDir := fs.GetBaseDirForFilePaths(inputFilePaths)
if fi, err := os.Stat(baseDir); err != nil || !fi.IsDir() {
	return fmt.Errorf("project directory %s missing or not a directory", baseDir)
}

Type guard

// Go: verify GetProjectPaths result before use
func projectPathsValid(p *fs.ProjectPaths) bool {
	return p != nil && p.ActivePaths != nil
}

Try / catch

// Go: wrap with actionable context
paths, err := fs.GetProjectPaths(baseDir)
if err != nil {
	return fmt.Errorf("failed to get project paths for %s (check dir exists and ignore files parse): %w", baseDir, err)
}

Prevention

When it happens

Trigger: fs.GetProjectPaths(baseDir) returns an error — baseDir does not exist or is unreadable, .gitignore/.plandexignore can't be parsed/read, or permission errors walking the tree.

Common situations: Loading files from a directory that was moved/deleted; running the CLI outside the project root with relative paths; malformed .gitignore causing the ignore parser to fail; unreadable subdirectory due to permissions.

Related errors


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