{"record":{"id":"f33a21c26be37d2d","repo":"JuliusBrussee/caveman","slug":"mapped-source-path-q-for-target-q-was-not-found","errorCode":null,"errorMessage":"mapped source path %q for target %q was not found in any record","messagePattern":"mapped source path %q for target %q was not found in any record","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/importers/generic.go","lineNumber":84,"sourceCode":"\tif len(records) == 0 {\n\t\treturn []Span{}, nil\n\t}\n\n\trows := make([]Span, 0, len(records))\n\tresolvedTargets := make(map[string]bool, len(opts.FieldMap))\n\tfor i, rec := range records {\n\t\tsp, resolved, err := mapGeneric(rec, opts)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"generic record %d: %w\", i+1, err)\n\t\t}\n\t\tfor target := range resolved {\n\t\t\tresolvedTargets[target] = true\n\t\t}\n\t\trows = append(rows, sp)\n\t}\n\tfor target, path := range opts.FieldMap {\n\t\tif !resolvedTargets[target] {\n\t\t\treturn nil, fmt.Errorf(\"mapped source path %q for target %q was not found in any record\", path, target)\n\t\t}\n\t}\n\treturn rows, nil\n}\n\nfunc validateGenericFieldMap(fieldMap map[string]string) error {\n\tif len(fieldMap) == 0 {\n\t\treturn fmt.Errorf(\"generic import requires a non-empty field map\")\n\t}\n\tfor target, path := range fieldMap {\n\t\tif _, ok := genericTargets[target]; !ok {\n\t\t\treturn fmt.Errorf(\"unknown target column %q (not a caveman.spans column)\", target)\n\t\t}\n\t\tif strings.TrimSpace(path) == \"\" {\n\t\t\treturn fmt.Errorf(\"generic target %q requires a non-empty source path\", target)\n\t\t}\n\t}\n\tfor _, target := range []string{\"trace_id\", \"span_id\", \"timestamp\"} {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/importers/generic.go#L66-L102","documentation":"After mapping all records, parseGeneric verifies every path in the field map resolved in at least one record. The reported mapped path was found nowhere in the input, so the mapping is useless and likely wrong.","triggerScenarios":"Parse() with a FieldMap entry whose source path (e.g. \"payload.duration_ms\") does not exist in any record of the input.","commonSituations":"Typos or wrong casing in path names; field map written for a different schema version than the input; expecting nested fields the exporter never emitted; upstream column renames.","solutions":["Remove or correct the FieldMap entry for the reported path.","Inspect actual record keys (e.g. jq 'keys' on the first record) and align paths.","Check casing and nesting separators match what mapGeneric expects.","Regenerate the field map from a sample record of the actual input."],"exampleFix":"// before\nfieldMap := map[string]string{\"timestamp\": \"ts_ms\", \"trace_id\": \"traceId\"} // \"ts_ms\" absent\n// after\nfieldMap := map[string]string{\"timestamp\": \"timestamp\", \"trace_id\": \"traceId\"}","handlingStrategy":"validation","validationCode":"present := map[string]bool{}\nfor _, rec := range records {\n\tfor _, path := range opts.FieldMap {\n\t\tif _, ok := lookupPath(rec, path); ok {\n\t\t\tpresent[path] = true\n\t\t}\n\t}\n}\nfor target, path := range opts.FieldMap {\n\tif !present[path] {\n\t\tfmt.Printf(\"unresolved mapping: %s -> %s\\n\", target, path)\n\t}\n}","typeGuard":null,"tryCatchPattern":"rows, err := importers.ParseGeneric(data, opts)\nif err != nil {\n\tif strings.Contains(err.Error(), \"was not found in any record\") {\n\t\treturn fmt.Errorf(\"field map does not match input schema: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Derive field map paths from an actual sample record of the input.","Watch key casing and nesting separators when writing paths.","Diff the field map against the input schema whenever either changes.","Log resolved vs unresolved targets in a dry-run mode."],"tags":["generic-import","field-map","importer","config"],"backgroundTag":"schema-validation-failed","analyzedSha":"3ee70a102609e550bd2e68004bf5990a9341c851","analyzedAt":"2026-09-20T15:53:39.229Z","contentChangedAt":"2026-09-20T15:53:39.229Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}