{"record":{"id":"9db95cb7f2e5d244","repo":"plandex-ai/plandex","slug":"context-timeout","errorCode":null,"errorMessage":"context timeout","messagePattern":"context timeout","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/cli/fs/projects.go","lineNumber":75,"sourceCode":"\t\t\t\t\treturn filepath.SkipDir\n\t\t\t\t} else {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn err\n\t\t}\n\n\t\tif strings.HasPrefix(info.Name(), \".\") {\n\t\t\tif info.IsDir() {\n\t\t\t\treturn filepath.SkipDir\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn fmt.Errorf(\"context timeout\")\n\t\tdefault:\n\t\t}\n\n\t\tif info.IsDir() && path != Cwd {\n\t\t\tplandexDir := findPlandex(path)\n\t\t\tprojectSettingsPath := filepath.Join(plandexDir, \"projects-v2.json\")\n\t\t\tif _, err := os.Stat(projectSettingsPath); err == nil {\n\t\t\t\tbytes, err := os.ReadFile(projectSettingsPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"error reading projectId file: %s\", err)\n\t\t\t\t}\n\t\t\t\tvar settingsByAccount types.CurrentProjectSettingsByAccount\n\t\t\t\terr = json.Unmarshal(bytes, &settingsByAccount)\n\n\t\t\t\tif err != nil {\n\t\t\t\t\tterm.OutputErrorAndExit(\"error unmarshalling projects-v2.json: %v\", err)\n\t\t\t\t}\n","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/fs/projects.go#L57-L93","documentation":"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.","triggerScenarios":"The caller-supplied context is cancelled or times out while walking the directory tree looking for nested .plandex/projects-v2.json files.","commonSituations":"Large/deep directory trees (huge monorepos, node_modules) taking longer than the context deadline; user cancellation; parent command timeout.","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"],"exampleFix":"// before\nctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)\n// after\nctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)\nchildIds, err := GetChildProjectIdsWithPaths(ctx)","handlingStrategy":"retry","validationCode":"if deadline, ok := ctx.Deadline(); ok && time.Until(deadline) < 30*time.Second {\n    ctx, _ = context.WithTimeout(context.Background(), time.Minute) // extend\n}","typeGuard":null,"tryCatchPattern":"ids, err := GetChildProjectIdsWithPaths(ctx)\nif err != nil && err.Error() == \"context timeout\" {\n    ids, err = retryWithLongerTimeout(ctx) // walk is resumable; sentinel already returns partials\n}","preventionTips":["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"],"tags":["context","timeout","filesystem-walk"],"backgroundTag":"context-deadline-exceeded","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}