JuliusBrussee/caveman · error
mapped source path for target was not found in any record
Error message
mapped source path %q for target %q was not found in any record
What it means
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.
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.
Example fix
// before
fieldMap := map[string]string{"timestamp": "ts_ms", "trace_id": "traceId"} // "ts_ms" absent
// after
fieldMap := map[string]string{"timestamp": "timestamp", "trace_id": "traceId"} Defensive patterns
Strategy: validation
Validate before calling
present := map[string]bool{}
for _, rec := range records {
for _, path := range opts.FieldMap {
if _, ok := lookupPath(rec, path); ok {
present[path] = true
}
}
}
for target, path := range opts.FieldMap {
if !present[path] {
fmt.Printf("unresolved mapping: %s -> %s\n", target, path)
}
} Try / catch
rows, err := importers.ParseGeneric(data, opts)
if err != nil {
if strings.Contains(err.Error(), "was not found in any record") {
return fmt.Errorf("field map does not match input schema: %w", err)
}
return err
} Prevention
- 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.
When it happens
Trigger: Parse() with a FieldMap entry whose source path (e.g. "payload.duration_ms") does not exist in any record of the input.
Common situations: 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.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- generic import requires a non-empty field map
- generic import requires a
- generic record
- generic target requires a non-empty source path
- unknown target column
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/f33a21c26be37d2d.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/importers/generic.go:84
if len(records) == 0 {
return []Span{}, nil
}
rows := make([]Span, 0, len(records))
resolvedTargets := make(map[string]bool, len(opts.FieldMap))
for i, rec := range records {
sp, resolved, err := mapGeneric(rec, opts)
if err != nil {
return nil, fmt.Errorf("generic record %d: %w", i+1, err)
}
for target := range resolved {
resolvedTargets[target] = true
}
rows = append(rows, sp)
}
for target, path := range opts.FieldMap {
if !resolvedTargets[target] {
return nil, fmt.Errorf("mapped source path %q for target %q was not found in any record", path, target)
}
}
return rows, nil
}
func validateGenericFieldMap(fieldMap map[string]string) error {
if len(fieldMap) == 0 {
return fmt.Errorf("generic import requires a non-empty field map")
}
for target, path := range fieldMap {
if _, ok := genericTargets[target]; !ok {
return fmt.Errorf("unknown target column %q (not a caveman.spans column)", target)
}
if strings.TrimSpace(path) == "" {
return fmt.Errorf("generic target %q requires a non-empty source path", target)
}
}
for _, target := range []string{"trace_id", "span_id", "timestamp"} {View on GitHub (pinned to 3ee70a1026)