plandex-ai/plandex · error

error walking directory: %s

Error message

error walking directory: %s

What it means

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.

Source

Thrown at app/cli/fs/paths.go:266

					if !isGitRepo {
						mu.Lock()
						defer mu.Unlock()
						activePaths[relPath] = true

						parentDir := relPath
						for parentDir != "." && parentDir != "/" && parentDir != "" {
							parentDir = filepath.Dir(parentDir)
							activeDirs[parentDir] = true
						}
					}
				}

				return nil
			})

			if err != nil {
				errCh <- fmt.Errorf("error walking directory: %s", err)
				return
			}

			errCh <- nil
		}()
	}

	for i := 0; i < numRoutines; i++ {
		err := <-errCh
		if err != nil {
			return nil, err
		}
	}

	for dir := range activeDirs {
		allDirs[dir] = true
	}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Check permissions on the project directory and its subdirectories (`ls -laR` or `find <dir> -not -readable`) and restore read access.
  2. Read the wrapped error in the message (%s) to identify the exact file that failed and fix that specific entry (chmod, delete, or ignore).
  3. Ensure the directory isn't being modified concurrently (stop editors/build tools or rescan on a stable tree).
  4. If walking a network mount fails, copy or mount the project locally before scanning.
  5. Confirm the working directory is a normal project directory, not a protected or system path.

Example fix

// before (shell)
$ plandex load
error walking directory: open /project/secret: permission denied
// after (shell)
$ chmod u+rx /project/secret
$ plandex load
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := os.ReadDir(baseDir); err != nil {
	return fmt.Errorf("cannot read directory %s: %w", baseDir, err)
}
// optionally probe readability of subdirs
filepath.WalkDir(baseDir, func(p string, d os.DirEntry, err error) error {
	if err != nil {
		return fmt.Errorf("unreadable entry %s: %w", p, err)
	}
	return nil
})

Try / catch

if err := <-errCh; err != nil {
	var permErr *os.PathError
	if errors.As(err, &permErr) && os.IsPermission(permErr) {
		// chmod / skip that path and retry
	}
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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