{"record":{"id":"5138287f49ede377","repo":"plandex-ai/plandex","slug":"panic-in-loadcachedfilemaphandler-v-s","errorCode":null,"errorMessage":"panic in LoadCachedFileMapHandler: %v\n%s","messagePattern":"panic in LoadCachedFileMapHandler: (.+?)\n(.+?)","errorType":"panic","errorClass":null,"httpStatus":500,"severity":"error","filePath":"app/server/handlers/file_maps.go","lineNumber":140,"sourceCode":"\t}\n\n\tvar req shared.LoadCachedFileMapRequest\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Error decoding request: %v\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tcachedMetaByPath := map[string]*shared.Context{}\n\tcachedMapsByPath := map[string]*db.CachedMap{}\n\tvar mu sync.Mutex\n\terrCh := make(chan error, len(req.FilePaths))\n\n\tfor _, path := range req.FilePaths {\n\t\tgo func(path string) {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tlog.Printf(\"panic in LoadCachedFileMapHandler: %v\\n%s\", r, debug.Stack())\n\t\t\t\t\terrCh <- fmt.Errorf(\"panic in LoadCachedFileMapHandler: %v\\n%s\", r, debug.Stack())\n\t\t\t\t\truntime.Goexit() // don't allow outer function to continue and double-send to channel\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tcachedContext, err := db.GetCachedMap(plan.OrgId, plan.ProjectId, path)\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error getting cached map: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif cachedContext != nil {\n\t\t\t\tmu.Lock()\n\t\t\t\tcachedMetaByPath[path] = cachedContext.ToMeta().ToApi()\n\t\t\t\tcachedMapsByPath[path] = &db.CachedMap{\n\t\t\t\t\tMapParts:  cachedContext.MapParts,\n\t\t\t\t\tMapShas:   cachedContext.MapShas,\n\t\t\t\t\tMapTokens: cachedContext.MapTokens,\n\t\t\t\t\tMapSizes:  cachedContext.MapSizes,\n\t\t\t\t}","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/file_maps.go#L122-L158","documentation":"Recovery guard in LoadCachedFileMapHandler's per-path goroutine: a panic occurred while loading a cached file map. Panic value and stack are logged and sent to errCh; Goexit prevents double-send to the channel.","triggerScenarios":"Thrown at app/server/handlers/file_maps.go:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the logged stack trace for the panicking code","Check for nil CachedMap/Context entries for that path","Fix the root cause; recover is only crash protection"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}