{"record":{"id":"b0c9f92eca826bf3","repo":"plandex-ai/plandex","slug":"failed-to-process-map-batches-v-b0c9f9","errorCode":null,"errorMessage":"failed to process map batches: %v","messagePattern":"failed to process map batches: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/lib/context_update.go","lineNumber":832,"sourceCode":"\t\t\t\t\t\terrs = append(errs, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\thasAnyUpdate := len(state.removedMapPaths) > 0 || len(state.mapInputShas) > 0\n\n\t\t\t\tif hasAnyUpdate {\n\t\t\t\t\tmu.Lock()\n\t\t\t\t\tdefer mu.Unlock()\n\n\t\t\t\t\tupdatedContexts = append(updatedContexts, ctx)\n\n\t\t\t\t\tnumMaps++\n\n\t\t\t\t\treqFns[ctx.Id] = func() (*shared.UpdateContextParams, error) {\n\t\t\t\t\t\tupdatedMapBodies, err := processMapBatches(state.mapInputBatches)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn nil, fmt.Errorf(\"failed to process map batches: %v\", err)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn &shared.UpdateContextParams{\n\t\t\t\t\t\t\tMapBodies:       updatedMapBodies,\n\t\t\t\t\t\t\tInputShas:       state.mapInputShas,\n\t\t\t\t\t\t\tInputTokens:     state.mapInputTokens,\n\t\t\t\t\t\t\tInputSizes:      state.mapInputSizes,\n\t\t\t\t\t\t\tRemovedMapPaths: state.removedMapPaths,\n\t\t\t\t\t\t}, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}(context)\n\n\t\tcase shared.ContextURLType:\n\t\t\twg.Add(1)\n\t\t\tgo func(ctx *shared.Context) {\n\t\t\t\tdefer wg.Done()","sourceCodeStart":814,"sourceCodeEnd":850,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/lib/context_update.go#L814-L850","documentation":"Top-level wrapper for failures in processMapBatches, which assembles the updated repo-map bodies from the computed input batches. If any batch computation fails (which may itself include upstream API/tokenization errors), the whole map update for that context is aborted with this message.","triggerScenarios":"The reqFns entry for a map context calls processMapBatches(state.mapInputBatches) and receives a non-nil error — any underlying batch failure (content read, token budget exceeded, upstream provider error) is propagated here.","commonSituations":"Map too large for the model's token budget after many files changed at once; underlying provider/API call inside batch processing failed; empty or corrupted batch input after partial phase failures upstream.","solutions":["Inspect the wrapped %v for the true root cause (API error vs read error vs budget).","Reduce the map size (exclude directories via ignore rules) if a token-budget error is reported.","Retry after transient network/provider failures.","Rebuild the map context if its batches are stale or corrupted."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// estimate map size before refresh\nif totalMapTokens > maxModelTokens {\n    return fmt.Errorf(\"map too large (%d tokens); exclude dirs via ignore rules\", totalMapTokens)\n}","typeGuard":null,"tryCatchPattern":"updated, err := refreshMapContext(ctx)\nif err != nil {\n    log.Printf(\"map refresh failed, keeping previous map: %v\", err)\n    updated = previousMap\n}","preventionTips":["Trim map size with ignore rules before large refreshes","Retry after transient provider/network errors","Rebuild map contexts that fail repeatedly","Monitor the wrapped root cause, not the wrapper"],"tags":["repo-map","batching","tokens"],"backgroundTag":"map-batch-processing-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"}