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.
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)
Solutions
- Increase the context deadline passed to GetChildProjectIdsWithPaths
- Exclude heavy directories (vendor, node_modules) from the walk
- Run in a shallower directory tree or use the partially collected results (the caller returns collected IDs on this sentinel)
- 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
- Give generous deadlines for filesystem scans of large trees
- Prune huge dependency dirs (node_modules, vendor) from scanned trees
- Avoid cancelling parent commands while the walk is in flight
- Cache discovered project IDs to shorten subsequent walks
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
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- context canceled while waiting to retry: %w
- Request was cancelled
- connection to plan stream timed out due to missing heartbeat
- refresh failed - http: %w
- failed to check context conflicts: %v
AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05).
Data as JSON: /api/errors/9db95cb7f2e5d244.
Report an issue: GitHub.