{"record":{"id":"60edd587a0d1b6a5","repo":"JuliusBrussee/caveman","slug":"unknown-target-column-q-not-a-caveman-spans-colu","errorCode":null,"errorMessage":"unknown target column %q (not a caveman.spans column)","messagePattern":"unknown target column %q \\(not a caveman\\.spans column\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/importers/generic.go","lineNumber":96,"sourceCode":"\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\"} {\n\t\tif _, ok := fieldMap[target]; !ok {\n\t\t\treturn fmt.Errorf(\"generic import requires a %q mapping\", target)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc decodeGenericRecords(data []byte) ([]map[string]any, error) {\n\t// Try a bare array first.\n\tvar arr []map[string]any\n\tif err := json.Unmarshal(data, &arr); err == nil {\n\t\treturn arr, nil","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/importers/generic.go#L78-L114","documentation":"Error from validateGenericFieldMap: the field map for a generic import names a target column that is not one of the known caveman.spans columns. Import targets are a closed set; the offending target name is echoed so the map can be fixed.","triggerScenarios":"Parse() with a FieldMap containing a target like \"start_time\" or \"id\" that is not a caveman.spans column.","commonSituations":"Guessing column names instead of consulting the schema; mapping names from another tracing schema (OTel attribute names, Datadog columns); typos like \"traceid\" vs \"trace_id\".","solutions":["Replace the unknown key with a valid caveman.spans column name (trace_id, span_id, timestamp, service, name, etc.).","Check the genericTargets set in shared/platform/importers/generic.go for accepted columns.","Use snake_case exactly — the lookup is exact-match.","Mirror validateGenericFieldMap checks in your own tooling to catch this before Parse()."],"exampleFix":"// before\nfieldMap := map[string]string{\"id\": \"span_id_raw\"}\n// after\nfieldMap := map[string]string{\"span_id\": \"span_id_raw\"}","handlingStrategy":"validation","validationCode":"var genericTargets = map[string]bool{\n\t\"trace_id\": true, \"span_id\": true, \"timestamp\": true, // ...other caveman.spans columns\n}\nfor target := range opts.FieldMap {\n\tif !genericTargets[target] {\n\t\treturn fmt.Errorf(\"unknown target %q\", target)\n\t}\n}","typeGuard":null,"tryCatchPattern":"rows, err := importers.ParseGeneric(data, opts)\nif err != nil {\n\tif strings.Contains(err.Error(), \"unknown target column\") {\n\t\treturn fmt.Errorf(\"check field map target names against caveman.spans schema: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Copy target names directly from the caveman.spans schema / genericTargets set.","Use snake_case exactly; matching is exact-string.","Keep an enumerated constant list of valid targets in your tooling for autocomplete."],"tags":["generic-import","field-map","schema","config"],"backgroundTag":"invalid-enum-value","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"}