{"record":{"id":"fae820ca74964cfa","repo":"JuliusBrussee/caveman","slug":"mapped-timestamp-is-missing-or-invalid","errorCode":null,"errorMessage":"mapped timestamp is missing or invalid","messagePattern":"mapped timestamp is missing or invalid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/importers/generic.go","lineNumber":165,"sourceCode":"\t\tcase \"time\":\n\t\t\ts, ns := parseTimeFlexible(val)\n\t\t\tif target == \"timestamp\" {\n\t\t\t\tsp.Timestamp = s\n\t\t\t\tstartNs = ns\n\t\t\t} else {\n\t\t\t\tsp.EndTimestamp = s\n\t\t\t\tendNs = ns\n\t\t\t}\n\t\t}\n\t}\n\tif strings.TrimSpace(sp.TraceID) == \"\" {\n\t\treturn Span{}, nil, fmt.Errorf(\"mapped trace_id is empty\")\n\t}\n\tif strings.TrimSpace(sp.SpanID) == \"\" {\n\t\treturn Span{}, nil, fmt.Errorf(\"mapped span_id is empty\")\n\t}\n\tif sp.Timestamp == \"\" {\n\t\treturn Span{}, nil, fmt.Errorf(\"mapped timestamp is missing or invalid\")\n\t}\n\tif d := durationMS(startNs, endNs); d > 0 {\n\t\tsp.DurationMS = d\n\t}\n\tsp.Attributes = map[string]string{\"import.source\": \"generic\"}\n\tapplyScope(&sp, opts)\n\treturn sp, resolved, nil\n}\n\nfunc assignString(sp *Span, target, v string) {\n\tswitch target {\n\tcase \"trace_id\":\n\t\tsp.TraceID = v\n\tcase \"span_id\":\n\t\tsp.SpanID = v\n\tcase \"parent_span_id\":\n\t\tsp.ParentSpanID = v\n\tcase \"agent_slug\":","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/3ee70a102609e550bd2e68004bf5990a9341c851/shared/platform/importers/generic.go#L147-L183","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\n{\"created_at\":\"01/02/2024 3 PM\"}\n// after\n{\"created_at\":\"2024-01-02T15:00:00Z\"}","handlingStrategy":"validation","validationCode":"func parseableTime(rec map[string]any, path string) bool {\n  v, ok := lookupPath(rec, path); if !ok { return false }\n  s, ok := v.(string); if !ok || s == \"\" { return false }\n  _, err := time.Parse(time.RFC3339, s)\n  return err == nil\n}\n// guard: if !parseableTime(rec, fieldMap[\"timestamp\"]) { normalize or skip }","typeGuard":null,"tryCatchPattern":"rows, err := importers.Parse(data, opts)\nif err != nil {\n  if strings.Contains(err.Error(), \"mapped timestamp is missing or invalid\") {\n    return fmt.Errorf(\"normalize timestamps to RFC3339 before import: %w\", err)\n  }\n  return err\n}","preventionTips":["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"],"tags":["import","timestamp","validation"],"backgroundTag":"invalid-date-format","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"}