{"record":{"id":"d4122c6aadfa9ed9","repo":"vectordotdev/vector","slug":"tried-to-clean-schema-reference-that-does-not-start-with-the","errorCode":null,"errorMessage":"Tried to clean schema reference that does not start with the definition prefix: {schema_ref}","messagePattern":"Tried to clean schema reference that does not start with the definition prefix: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/vector-config-common/src/schema/json_schema.rs","lineNumber":618,"sourceCode":"        match self {\n            SingleOrVec::Single(s) => s.deref() == x,\n            SingleOrVec::Vec(v) => v.contains(x),\n        }\n    }\n}\n\nfn is_none_or_default_true(field: &Option<Box<Schema>>) -> bool {\n    match field {\n        None => true,\n        Some(value) => matches!(value.as_ref(), Schema::Bool(true)),\n    }\n}\n\npub fn get_cleaned_schema_reference(schema_ref: &str) -> &str {\n    if let Some(cleaned) = schema_ref.strip_prefix(DEFINITIONS_PREFIX) {\n        cleaned\n    } else {\n        panic!(\n            \"Tried to clean schema reference that does not start with the definition prefix: {schema_ref}\"\n        );\n    }\n}\n","sourceCodeStart":600,"sourceCodeEnd":623,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/vector-config-common/src/schema/json_schema.rs#L600-L623","documentation":"Panic from `.expect(\"invalid timestamp\")` in `decode_ddseries_v2` (src/sources/datadog_agent/metrics.rs:324), converting a Datadog series v2 point's `timestamp` (i64, seconds since epoch) into chrono `DateTime<Utc>` via `Utc.timestamp_opt(dd_point.timestamp, 0)`. `timestamp_opt` returns None when the seconds value is outside chrono's representable range (roughly years -262144..262143), so the expect fires on a corrupt or absurd point timestamp.","triggerScenarios":"A Datadog agent payload (protobuf v2 series) containing a point whose `timestamp` i64 is out of range — e.g. 0 interpreted with a different epoch unit, microseconds/nanoseconds instead of seconds, or negative/garbage values — reaching `Utc.timestamp_opt(dd_point.timestamp, 0).single()`.","commonSituations":"A non-standard or buggy Datadog-compatible agent sending epoch-milliseconds in the seconds field (values ~1.7e12 overflow chrono's valid range); fuzzed or hand-crafted requests to the Datadog agent listener; protobuf field misinterpretation after schema changes.","solutions":["Bounds-check `dd_point.timestamp` (e.g. within 0..=253_402_300_799) before conversion and skip/derive the point otherwise.","Replace expect with `.single()` propagated via `?`/filter so out-of-range points are dropped with a warning event instead of panicking the decode task.","If the producer sends milliseconds, divide by 1000 before calling `timestamp_opt`."],"exampleFix":"// before\n.with_timestamp(Some(\n    Utc.timestamp_opt(dd_point.timestamp, 0)\n        .single()\n        .expect(\"invalid timestamp\"),\n))\n// after\nmatch Utc.timestamp_opt(dd_point.timestamp, 0).single() {\n    Some(ts) => { /* .with_timestamp(Some(ts)) */ }\n    None => { emit!(DatadogPointTimestampInvalid { ts: dd_point.timestamp }); return None; }\n}","handlingStrategy":"validation","validationCode":"fn valid_dd_timestamp(secs: i64) -> bool {\n    (0..=253_402_300_799).contains(&secs)\n}","typeGuard":"fn dd_ts_to_utc(secs: i64) -> Option<DateTime<Utc>> {\n    if !(0..=253_402_300_799).contains(&secs) { return None; }\n    Utc.timestamp_opt(secs, 0).single()\n}","tryCatchPattern":"// Propagate None and skip the point instead of expect:\nlet ts = Utc.timestamp_opt(dd_point.timestamp, 0).single()?;\n// ... .with_timestamp(Some(ts))","preventionTips":["Sanitize untrusted Datadog agent payloads: bound-check point timestamps before chrono conversion.","Detect unit mismatches (ms vs s) by magnitude (>~1e11 means ms/micros) and convert or reject.","Fuzz the Datadog v2 decoder with extreme i64 timestamps."],"tags":["datadog","metrics","timestamp","chrono","rust","panic"],"backgroundTag":"value-out-of-range","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}