plandex-ai/plandex · error

failed to get project paths: %v

Error message

failed to get project paths: %v

What it means

Inside Rollback, a dedicated goroutine re-reads the project's path set via fs.GetProjectPaths(fs.ProjectRoot) so it can compute which paths are new (not present in rollbackPlan.PreviousProjectPaths) and remove them. If GetProjectPaths fails, this error wraps the failure and is sent to the error channel.

Source

Thrown at app/cli/lib/apply.go:781

		}(path, revert)
	}

	for _, path := range rollbackPlan.ToRemove {
		go func(path string) {
			err := os.Remove(path)
			if err != nil {
				errCh <- fmt.Errorf("failed to remove %s: %s", path, err.Error())
				return
			}
			errCh <- nil
		}(path)
	}

	go func() {
		var err error
		updatedProjectPaths, err := fs.GetProjectPaths(fs.ProjectRoot)
		if err != nil {
			errCh <- fmt.Errorf("failed to get project paths: %v", err)
		}
		var toRemove []string
		for path := range updatedProjectPaths.AllPaths {
			if _, ok := rollbackPlan.PreviousProjectPaths.AllPaths[path]; !ok {
				toRemove = append(toRemove, path)
			}
		}
		pathsErrCh := make(chan error, len(toRemove))
		for _, path := range toRemove {
			go func(path string) {
				err := os.Remove(path)
				pathsErrCh <- err
			}(path)
		}
		for range toRemove {
			err := <-pathsErrCh
			if err != nil {
				errCh <- fmt.Errorf("failed to remove %s: %s", toRemove, err.Error())

View on GitHub (pinned to e2d772072e)

Solutions

  1. Verify ProjectRoot points to an existing, readable directory before calling Rollback (os.Stat the path).
  2. Fix the project root configuration if it references a stale path.
  3. Check walk permissions on all subdirectories of ProjectRoot.
  4. If the root legitimately no longer exists, treat removal of remaining new paths as unnecessary and skip the GetProjectPaths step.

Example fix

// before
updatedProjectPaths, err := fs.GetProjectPaths(fs.ProjectRoot)
if err != nil {
	errCh <- fmt.Errorf("failed to get project paths: %v", err)
}
// after
if _, statErr := os.Stat(fs.ProjectRoot); statErr != nil {
	errCh <- nil // root gone, nothing new to remove
	return
}
updatedProjectPaths, err := fs.GetProjectPaths(fs.ProjectRoot)
if err != nil {
	errCh <- fmt.Errorf("failed to get project paths: %v", err)
	return
}
Defensive patterns

Strategy: validation

Validate before calling

if st, err := os.Stat(fs.ProjectRoot); err != nil || !st.IsDir() {
	// root missing: nothing to prune, skip GetProjectPaths
}
func dirReadable(p string) error {
	f, err := os.Open(p)
	if err != nil {
		return err
	}
	return f.Close()
}

Try / catch

err := Rollback(plan, true)
if err != nil && strings.Contains(err.Error(), "failed to get project paths") {
	// verify/fix ProjectRoot then retry rollback
}

Prevention

When it happens

Trigger: fs.GetProjectPaths(fs.ProjectRoot) returns a non-nil error during rollback — typically because ProjectRoot does not exist, is unreadable, or the underlying path walk (e.g. filepath.WalkDir) hits a permission or IO error.

Common situations: The project root directory was deleted or renamed before rollback; ProjectRoot is configured incorrectly (bad path in config); walking the tree encounters unreadable subdirectories; running from a different working directory with a stale ProjectRoot.

Related errors


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