plandex-ai/plandex · warning

context timeout

Error message

context timeout

What it means

During the filepath.WalkDir traversal in GetChildProjectIdsWithPaths, a non-blocking select checks ctx.Done() before each directory visit; if the context has been cancelled or its deadline exceeded, the walk aborts with this sentinel error.

Solutions

  1. Increase the context deadline passed to GetChildProjectIdsWithPaths
  2. Exclude heavy directories (vendor, node_modules) from the walk
  3. Run in a shallower directory tree or use the partially collected results (the caller returns collected IDs on this sentinel)
  4. Ensure the context isn't cancelled prematurely by an upstream timeout

Example fix

// before
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
// after
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
childIds, err := GetChildProjectIdsWithPaths(ctx)
Defensive patterns

Strategy: retry

Validate before calling

if deadline, ok := ctx.Deadline(); ok && time.Until(deadline) < 30*time.Second {
    ctx, _ = context.WithTimeout(context.Background(), time.Minute) // extend
}

Try / catch

ids, err := GetChildProjectIdsWithPaths(ctx)
if err != nil && err.Error() == "context timeout" {
    ids, err = retryWithLongerTimeout(ctx) // walk is resumable; sentinel already returns partials
}

Prevention

When it happens

Trigger: The caller-supplied context is cancelled or times out while walking the directory tree looking for nested .plandex/projects-v2.json files.

Common situations: Large/deep directory trees (huge monorepos, node_modules) taking longer than the context deadline; user cancellation; parent command timeout.

Understand the failure class

Related errors


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

Appendix: source

Thrown at app/cli/fs/projects.go:75

					return filepath.SkipDir
				} else {
					return nil
				}
			}

			return err
		}

		if strings.HasPrefix(info.Name(), ".") {
			if info.IsDir() {
				return filepath.SkipDir
			}
			return nil
		}

		select {
		case <-ctx.Done():
			return fmt.Errorf("context timeout")
		default:
		}

		if info.IsDir() && path != Cwd {
			plandexDir := findPlandex(path)
			projectSettingsPath := filepath.Join(plandexDir, "projects-v2.json")
			if _, err := os.Stat(projectSettingsPath); err == nil {
				bytes, err := os.ReadFile(projectSettingsPath)
				if err != nil {
					return fmt.Errorf("error reading projectId file: %s", err)
				}
				var settingsByAccount types.CurrentProjectSettingsByAccount
				err = json.Unmarshal(bytes, &settingsByAccount)

				if err != nil {
					term.OutputErrorAndExit("error unmarshalling projects-v2.json: %v", err)
				}

View on GitHub (pinned to e2d772072e)