{"record":{"id":"adb87210ad7727dd","repo":"plandex-ai/plandex","slug":"failed-to-get-file-map-v","errorCode":null,"errorMessage":"failed to get file map: %v","messagePattern":"failed to get file map: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_shared.go","lineNumber":155,"sourceCode":"\nfunc processMapBatches(mapInputBatches []shared.FileMapInputs) (shared.FileMapBodies, error) {\n\tallMapBodies := shared.FileMapBodies{}\n\n\tvar mapMu sync.Mutex\n\terrCh := make(chan error, len(mapInputBatches))\n\n\tfor _, batch := range mapInputBatches {\n\t\tif len(batch) == 0 {\n\t\t\terrCh <- nil\n\t\t\tcontinue\n\t\t}\n\n\t\tgo func(batch shared.FileMapInputs) {\n\t\t\tmapRes, apiErr := api.Client.GetFileMap(shared.GetFileMapRequest{\n\t\t\t\tMapInputs: batch,\n\t\t\t})\n\t\t\tif apiErr != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"failed to get file map: %v\", apiErr)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmapMu.Lock()\n\t\t\tfor path, bodies := range mapRes.MapBodies {\n\t\t\t\tallMapBodies[path] = bodies\n\t\t\t}\n\t\t\tmapMu.Unlock()\n\t\t\terrCh <- nil\n\t\t}(batch)\n\t}\n\n\tfor i := 0; i < len(mapInputBatches); i++ {\n\t\terr := <-errCh\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_shared.go#L137-L173","documentation":"In the concurrent file-map worker, each batch calls api.Client.GetFileMap; on apiErr the goroutine sends this wrapped error into errCh. It means the server-side map generation for one or more batches failed, aborting the overall map operation.","triggerScenarios":"api.Client.GetFileMap(shared.GetFileMapRequest{MapInputs: batch}) fails for a batch — API outage, rate limiting on large batch fan-out, auth expiry, or server 5xx while mapping many files.","commonSituations":"Mapping very large repos producing many concurrent batches (rate limits); VPN/proxy interruptions; expired session mid-run.","solutions":["Retry the map operation — batch failures are often transient rate limits","Reduce the number of files mapped at once to shrink batch concurrency","Re-authenticate if the session expired during the run"],"exampleFix":"// before\nmapRes, apiErr := api.Client.GetFileMap(shared.GetFileMapRequest{MapInputs: batch})\nif apiErr != nil {\n    errCh <- fmt.Errorf(\"failed to get file map: %v\", apiErr)\n    return\n}\n// after — bounded retry for transient failures\nvar mapRes *shared.GetFileMapResponse\nvar apiErr error\nfor attempt := 0; attempt < 3; attempt++ {\n    mapRes, apiErr = api.Client.GetFileMap(shared.GetFileMapRequest{MapInputs: batch})\n    if apiErr == nil {\n        break\n    }\n    time.Sleep(time.Duration(1<<attempt) * time.Second)\n}\nif apiErr != nil {\n    errCh <- fmt.Errorf(\"failed to get file map: %v\", apiErr)\n    return\n}","handlingStrategy":"retry","validationCode":"if len(batch.Paths) == 0 {\n    return nil\n}\nif err := checkApiReachable(); err != nil {\n    return fmt.Errorf(\"API unreachable before mapping: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"select {\ncase err := <-errCh:\n    if isTransient(err) { // rate limit / 5xx\n        time.Sleep(backoff)\n        return getFileMapWithRetry(batches)\n    }\n    return fmt.Errorf(\"failed to get file map: %v\", err)\ncase res := <-doneCh:\n    return res, nil\n}","preventionTips":["Map fewer files at a time to avoid rate limits","Ensure stable connectivity for long map operations","Re-authenticate before very large mapping runs"],"tags":["api","network","concurrency","map"],"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"}