{"record":{"id":"41dbcde880efab18","repo":"vectordotdev/vector","slug":"failed-to-insert-timestamp","errorCode":null,"errorMessage":"failed to insert timestamp","messagePattern":"failed to insert timestamp","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/validation/runner/mod.rs","lineNumber":631,"sourceCode":"\n                // Convert unix timestamp in input events to the Datetime string.\n                // This is necessary when a source expects the incoming event to have a\n                // unix timestamp but we convert it into a datetime string in the source.\n                // For example, the `datadog_agent` source. This only takes effect when\n                // the test case YAML file defining the event, constructs it with the log\n                // builder variant, and specifies an integer in milliseconds for the timestamp.\n                if component_type == ComponentType::Source\n                    && let Event::Log(ref mut log) = event\n                    && let Some(ts) = log.remove_timestamp()\n                {\n                    let ts = match ts.as_integer() {\n                        Some(ts) => chrono::DateTime::from_timestamp_millis(ts)\n                            .unwrap_or_else(|| panic!(\"invalid timestamp in input test event {ts}\"))\n                            .into(),\n                        None => ts,\n                    };\n                    log.parse_path_and_insert(\"timestamp\", ts)\n                        .expect(\"failed to insert timestamp\");\n                }\n\n                // This particular metric is tricky because a component can run the\n                // EstimatedJsonSizeOf calculation on a single event or an array of\n                // events. If it's an array of events, the size calculation includes\n                // the size of bracket ('[', ']') characters... But we have no way\n                // of knowing which case it will be. Indeed, there are even components\n                // where BOTH scenarios are possible, depending on how the component\n                // is configured.\n                // This is handled in the component spec validator code where we compare\n                // the actual to the expected.\n                input_runner_metrics.sent_event_bytes_total +=\n                    event.estimated_json_encoded_size_of().get() as u64;\n            }\n        }\n        info!(\"Input driver sent all events.\");\n    })\n}","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/components/validation/runner/mod.rs#L613-L649","documentation":"When input test events carry a millisecond timestamp, the input driver normalizes it into the event's 'timestamp' field via log.parse_path_and_insert. Inserting into an event's log map is infallible for valid paths, so failure triggers this expect. It guards against the internal representation changing or the path lookup behaving unexpectedly.","triggerScenarios":"spawn_input_driver processing an input event whose 'timestamp' key cannot be parsed/inserted — currently only realistically triggered by changes to the event data model (parse_path_and_insert returning Err) or a corrupted/frozen test event value.","commonSituations":"Modifying the event/log value internals in vector-core so the fixed \"timestamp\" path no longer inserts cleanly; feeding test events with odd value types that a data-model change rejects.","solutions":["Re-run with the underlying Err surfaced (replace expect with unwrap_or_else printing the error) to identify which path/value failed.","After upgrading vector-core event types, update the input driver to use the new insertion API.","Verify test event fixtures contain a valid Value::Timestamp-compatible ts (DateTime::from_timestamp_millis already validated above)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert!(matches!(ts, Value::Timestamp(_)) || input_ts_millis.is_some(), \"input event timestamp must be a valid datetime\");","typeGuard":null,"tryCatchPattern":"log.parse_path_and_insert(\"timestamp\", ts)\n    .unwrap_or_else(|e| panic!(\"failed to insert timestamp: {e}\"));","preventionTips":["Keep input fixtures using millisecond epoch or RFC3339 timestamps.","Update the input driver after any vector-core event model API change.","Surface the underlying parse/insert error rather than a bare expect."],"tags":["timestamp","events","validation"],"backgroundTag":"invalid-date-format","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"}