{"record":{"id":"bc81749f88f3cc68","repo":"plandex-ai/plandex","slug":"error-checking-cached-file-map-v","errorCode":null,"errorMessage":"error checking cached file map: %v","messagePattern":"error checking cached file map: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_load.go","lineNumber":179,"sourceCode":"\t\tif params.DefsOnly {\n\t\t\tfor _, inputFilePath := range inputFilePaths {\n\t\t\t\tcomposite := strings.Join([]string{string(shared.ContextMapType), inputFilePath}, \"|\")\n\t\t\t\tif existsByComposite[composite] != nil {\n\t\t\t\t\talreadyLoadedByComposite[composite] = existsByComposite[composite]\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\ttoLoadMapPaths = append(toLoadMapPaths, inputFilePath)\n\t\t\t}\n\n\t\t\tvar uncachedMapPaths []string\n\n\t\t\tres, err := api.Client.LoadCachedFileMap(CurrentPlanId, CurrentBranch, shared.LoadCachedFileMapRequest{\n\t\t\t\tFilePaths: toLoadMapPaths,\n\t\t\t})\n\n\t\t\tif err != nil {\n\t\t\t\tonErr(fmt.Errorf(\"error checking cached file map: %v\", err))\n\t\t\t}\n\n\t\t\tif res.LoadRes != nil {\n\t\t\t\tif res.LoadRes.MaxTokensExceeded {\n\t\t\t\t\tterm.StopSpinner()\n\t\t\t\t\toverage := res.LoadRes.TotalTokens - res.LoadRes.MaxTokens\n\n\t\t\t\t\tterm.OutputErrorAndExit(\"Update would add %d 🪙 and exceed token limit (%d) by %d 🪙\\n\", res.LoadRes.TokensAdded, res.LoadRes.MaxTokens, overage)\n\t\t\t\t}\n\n\t\t\t\tcachedMapLoadRes = res.LoadRes\n\t\t\t\tcachedMapPaths = res.CachedByPath\n\n\t\t\t\tfor _, path := range toLoadMapPaths {\n\t\t\t\t\tif !cachedMapPaths[path] {\n\t\t\t\t\t\tuncachedMapPaths = append(uncachedMapPaths, path)\n\t\t\t\t\t}\n\t\t\t\t}","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_load.go#L161-L197","documentation":"When loading a project map (DefsOnly), MustLoadContext calls api.Client.LoadCachedFileMap to check which file-map paths are already cached server-side; this error means that call failed. It aborts via onErr since the cached-map optimization can't be validated.","triggerScenarios":"api.Client.LoadCachedFileMap(CurrentPlanId, CurrentBranch, req) returns an error — network failure, auth expiry, invalid plan/branch, or server error while looking up cached maps for FilePaths.","commonSituations":"Offline/proxy issue while running `plandex load --map`; stale session token; server version mismatch where the cached-file-map endpoint is unavailable; very large path list timing out.","solutions":["Check connectivity and retry the load command","Re-authenticate if auth-related","Ensure client and server versions match (update CLI/server)","Reduce the number of map paths loaded at once if the request is timing out"],"exampleFix":"// before\nres, err := api.Client.LoadCachedFileMap(CurrentPlanId, CurrentBranch, shared.LoadCachedFileMapRequest{\n\tFilePaths: toLoadMapPaths,\n})\nif err != nil {\n\tonErr(fmt.Errorf(\"error checking cached file map: %v\", err))\n}\n// after\nres, err := api.Client.LoadCachedFileMap(CurrentPlanId, CurrentBranch, shared.LoadCachedFileMapRequest{\n\tFilePaths: toLoadMapPaths,\n})\nif err != nil {\n\t// fall back to uncached map build instead of exiting\n\tterm.StopSpinner()\n\tterm.OutputErrorAndExit(\"error checking cached file map: %v (will rebuild maps from scratch)\", err)\n}","handlingStrategy":"fallback","validationCode":"// only query the cache for a bounded path list\nif len(toLoadMapPaths) > 500 {\n\tlog.Printf(\"%d map paths — consider batching the cached-map lookup\", len(toLoadMapPaths))\n}","typeGuard":"// Go: nil-guard the nested LoadRes before use\nfunc loadResSafe(res *shared.LoadCachedFileMapResponse) (*shared.LoadContextResponse, bool) {\n\tif res == nil || res.LoadRes == nil { return nil, false }\n\treturn res.LoadRes, true\n}","tryCatchPattern":"// Go: degrade gracefully to uncached map build\nres, err := api.Client.LoadCachedFileMap(planId, branch, req)\nif err != nil {\n\tlog.Printf(\"cached map check failed (%v); rebuilding maps from scratch\", err)\n\tuncachedMapPaths = toLoadMapPaths\n} else { /* normal path */ }","preventionTips":["Ensure CLI and server versions support the cached-file-map endpoint","Batch large map loads instead of one huge request","Check connectivity before `plandex load --map` on big repos","Retry after transient network errors"],"tags":["api","network","file-map","cache","cli"],"backgroundTag":"api-request-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}