{"record":{"id":"17abd511bc1a4000","repo":"plandex-ai/plandex","slug":"error-mapping-file-s-v","errorCode":null,"errorMessage":"error mapping file %s: %v","messagePattern":"error mapping file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/server/syntax/file_map/multi.go","lineNumber":57,"sourceCode":"\t\t\tmu.Lock()\n\t\t\tbodies[path] = \"[NO MAP]\"\n\t\t\tmu.Unlock()\n\t\t\terrCh <- nil\n\t\t\tcontinue\n\t\t} else if len(content) > shared.MaxContextMapSingleInputSize { // 1MB\n\t\t\tmu.Lock()\n\t\t\tbodies[path] = \"[NO MAP - TOO LARGE]\"\n\t\t\tmu.Unlock()\n\t\t\terrCh <- nil\n\t\t\tcontinue\n\t\t}\n\n\t\tsem <- struct{}{}\n\t\tgo func(path, content string) {\n\t\t\tdefer func() { <-sem }()\n\t\t\tfileMap, err := MapFile(ctx, path, []byte(content))\n\t\t\tif err != nil {\n\t\t\t\terrCh <- fmt.Errorf(\"error mapping file %s: %v\", path, err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tmu.Lock()\n\t\t\tdefer mu.Unlock()\n\t\t\tbodies[path] = fileMap.String()\n\t\t\terrCh <- nil\n\t\t}(path, content)\n\t}\n\n\tfor i := 0; i < len(inputs); i++ {\n\t\terr := <-errCh\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn bodies, nil\n}","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/syntax/file_map/multi.go#L39-L75","documentation":"multi.go maps many files concurrently using a semaphore-bounded goroutine pool. Each file is run through MapFile (tree-sitter based structural mapping); any error returned by MapFile is wrapped as 'error mapping file %s: %v' and sent to the error channel. It indicates the per-file mapping step failed for that specific path.","triggerScenarios":"MapFile(ctx, path, content) returns an error — typically an unsupported language/parser lookup failure or an internal parse failure for that file's content — during concurrent MultiMapFile processing.","commonSituations":"Batch-mapping a mixed-language codebase where some files have unrecognized extensions; empty or corrupted files; parser unavailable for a language on the installed tree-sitter grammars.","solutions":["Check the wrapped '%v' cause for the underlying MapFile failure","Confirm the file extension maps to a supported language/grammar","Exclude or skip unsupported files before calling the multi mapper","Update the syntax package/grammars if the language is expected to be supported"],"exampleFix":"// before\nresults, err := filemap.MultiMapFile(ctx, allPaths)\n// after\nfor _, p := range allPaths {\n    if parser, _, _, _ := syntax.GetParserForPath(p); parser == nil {\n        log.Printf(\"skipping unsupported file: %s\", p)\n    }\n}\nresults, err := filemap.MultiMapFile(ctx, supportedPaths)","handlingStrategy":"try-catch","validationCode":"parser, _, _, _ := syntax.GetParserForPath(path)\nif parser == nil {\n    return fmt.Errorf(\"no parser for %s, excluding from mapping\", path)\n}\nif len(content) == 0 {\n    return fmt.Errorf(\"empty file %s, excluding\", path)\n}","typeGuard":null,"tryCatchPattern":"err := <-errCh\nif err != nil && strings.HasPrefix(err.Error(), \"error mapping file \") {\n    var path string\n    fmt.Sscanf(err.Error(), \"error mapping file %s\", &path)\n    log.Printf(\"excluding failed file: %s\", path)\n}","preventionTips":["Pre-filter input files by supported extension","Skip empty or binary files before mapping","Keep tree-sitter grammars up to date","Collect per-file errors and continue instead of failing the batch"],"tags":["tree-sitter","file-mapping","go","concurrency"],"backgroundTag":"file-parse-failed","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"}