{"record":{"id":"abade4967cf21869","repo":"plandex-ai/plandex","slug":"file-s-is-too-large-d-max-d","errorCode":null,"errorMessage":"File %s is too large: %d (max %d)","messagePattern":"File (.+?) is too large: (.+?) \\(max (.+?)\\)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"app/server/handlers/file_maps.go","lineNumber":44,"sourceCode":"\n\tvar req shared.GetFileMapRequest\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\tlog.Println(\"GetFileMapHandler: checking limits\")\n\n\tif len(req.MapInputs) > shared.MaxContextMapPaths {\n\t\thttp.Error(w, fmt.Sprintf(\"Too many files to map: %d (max %d)\", len(req.MapInputs), shared.MaxContextMapPaths), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\ttotalSize := 0\n\tfor path, input := range req.MapInputs {\n\t\t// the client should be truncating inputs to the max size, but we'll check here too\n\t\tif len(input) > shared.MaxContextMapSingleInputSize {\n\t\t\thttp.Error(w, fmt.Sprintf(\"File %s is too large: %d (max %d)\", path, len(input), shared.MaxContextMapSingleInputSize), http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\ttotalSize += len(input)\n\t}\n\n\t// On the client, once the total size limit is exceeded, we send empty file maps for remaining files\n\tif totalSize > shared.MaxContextMapTotalInputSize+10000 {\n\t\thttp.Error(w, fmt.Sprintf(\"Max map size exceeded: %d (max %d)\", totalSize, shared.MaxContextMapTotalInputSize), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Check batch size limits\n\tif len(req.MapInputs) > shared.ContextMapMaxBatchSize {\n\t\thttp.Error(w, fmt.Sprintf(\"Batch contains too many files: %d (max %d)\", len(req.MapInputs), shared.ContextMapMaxBatchSize), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif int64(totalSize) > shared.ContextMapMaxBatchBytes {","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/handlers/file_maps.go#L26-L62","documentation":"GetFileMapHandler checks each entry of MapInputs against shared.MaxContextMapSingleInputSize (500KB). If any single file's content exceeds 500KB the handler returns HTTP 400 with 'File %s is too large: %d (max %d)' naming the path, its byte length, and the limit.","triggerScenarios":"A GetFileMapRequest includes one file whose byte slice is larger than 500*1024 bytes (524288).","commonSituations":"Committed lockfiles, minified bundles, generated protobufs, JSON dumps, or large fixtures included by an over-broad glob; client-side truncation (getMapFileContent/getMapFileDetails) bypassed or removed.","solutions":["Exclude the offending large file (returned in the error path) from MapInputs","Truncate or slice the file content to <= 500KB client-side before sending, as the CLI already does via MaxContextMapSingleInputSize checks","Increase coverage of ignore rules for generated/minified artifacts","If the file is genuinely needed, split it and send only the relevant portion"],"exampleFix":"// before\ninputs[path] = readFileBytes(path) // 2MB file\n// after\nb := readFileBytes(path)\nif len(b) > shared.MaxContextMapSingleInputSize {\n    b = b[:shared.MaxContextMapSingleInputSize]\n}\ninputs[path] = b","handlingStrategy":"validation","validationCode":"// Client-side check per file before sending\nfor path, data := range inputs {\n    if len(data) > shared.MaxContextMapSingleInputSize { // 500KB\n        return fmt.Errorf(\"file %s is %d bytes, max %d\", path, len(data), shared.MaxContextMapSingleInputSize)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Truncate file contents to 500KB client-side before adding to MapInputs","Maintain ignore rules for minified, generated, and lock files","Skip files larger than the cap during directory traversal","Log skipped/truncated files so large artifacts are noticed"],"tags":["go","http","file-size","validation"],"backgroundTag":"payload-size-limit-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"}