JuliusBrussee/caveman · error
mapped timestamp is missing or invalid
Error message
mapped timestamp is missing or invalid
What it means
After mapping, the generic importer requires a usable timestamp: the value at the mapped timestamp path must parse (via parseTimeFlexible) into a non-empty formatted time. This error means the path resolved but the value was absent-as-empty or in a format parseTimeFlexible cannot parse, so no start time could be established.
Solutions
- Normalize timestamps to RFC3339 (e.g. "2024-01-01T12:00:00Z") in the source data
- Verify the value is a parseable string or numeric epoch, not null/empty
- Check parseTimeFlexible's accepted formats and convert outliers before import
- Filter out records with missing timestamps before calling Parse
Example fix
// before
{"created_at":"01/02/2024 3 PM"}
// after
{"created_at":"2024-01-02T15:00:00Z"} Defensive patterns
Strategy: validation
Validate before calling
func parseableTime(rec map[string]any, path string) bool {
v, ok := lookupPath(rec, path); if !ok { return false }
s, ok := v.(string); if !ok || s == "" { return false }
_, err := time.Parse(time.RFC3339, s)
return err == nil
}
// guard: if !parseableTime(rec, fieldMap["timestamp"]) { normalize or skip } Try / catch
rows, err := importers.Parse(data, opts)
if err != nil {
if strings.Contains(err.Error(), "mapped timestamp is missing or invalid") {
return fmt.Errorf("normalize timestamps to RFC3339 before import: %w", err)
}
return err
} Prevention
- Standardize timestamps to RFC3339 UTC in exports
- Convert epoch units (ms/us/s) to a parseable format before import
- Reject or repair null timestamps for in-flight spans
- Test the timestamp path against every record in a sample batch
When it happens
Trigger: The mapped timestamp value is "", null, or a string in an unrecognized date format (e.g. a locale string, epoch in an exotic unit, or a non-string like a nested object).
Common situations: Epoch milliseconds exported as a raw number the parser cannot read; RFC3339 vs custom formats; null timestamps for in-flight spans; Excel-exported dates as locale text.
Related errors
- generic decode: expected a JSON array or
- invalid --since (want RFC3339)
- : verified_at is in the future
- : verified_at is older than 120 days
- mapped source path for required target was not found
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/fae820ca74964cfa.
Report an issue: GitHub.
Appendix: source
Thrown at shared/platform/importers/generic.go:165
case "time":
s, ns := parseTimeFlexible(val)
if target == "timestamp" {
sp.Timestamp = s
startNs = ns
} else {
sp.EndTimestamp = s
endNs = ns
}
}
}
if strings.TrimSpace(sp.TraceID) == "" {
return Span{}, nil, fmt.Errorf("mapped trace_id is empty")
}
if strings.TrimSpace(sp.SpanID) == "" {
return Span{}, nil, fmt.Errorf("mapped span_id is empty")
}
if sp.Timestamp == "" {
return Span{}, nil, fmt.Errorf("mapped timestamp is missing or invalid")
}
if d := durationMS(startNs, endNs); d > 0 {
sp.DurationMS = d
}
sp.Attributes = map[string]string{"import.source": "generic"}
applyScope(&sp, opts)
return sp, resolved, nil
}
func assignString(sp *Span, target, v string) {
switch target {
case "trace_id":
sp.TraceID = v
case "span_id":
sp.SpanID = v
case "parent_span_id":
sp.ParentSpanID = v
case "agent_slug":View on GitHub (pinned to 3ee70a1026)