{"record":{"id":"e8b86f5ade70aa1e","repo":"BoundaryML/baml","slug":"run-started-record-omitted-time-anchor","errorCode":null,"errorMessage":"run started record omitted time anchor","messagePattern":"run started record omitted time anchor","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_events/src/value/record.rs","lineNumber":412,"sourceCode":"            call: value.call.map(Into::into),\n            message: value.message.clone(),\n            timestamp_ms: value.timestamp_ms,\n        }\n    }\n}\n\nimpl TryFrom<crate::value::pb::RunStartedV1> for RunStartedRecord {\n    type Error = io::Error;\n\n    fn try_from(value: crate::value::pb::RunStartedV1) -> Result<Self, Self::Error> {\n        let target = value.target.ok_or_else(|| {\n            io::Error::new(\n                io::ErrorKind::InvalidData,\n                \"run started record omitted target\",\n            )\n        })?;\n        let time_anchor = value.time_anchor.ok_or_else(|| {\n            io::Error::new(\n                io::ErrorKind::InvalidData,\n                \"run started record omitted time anchor\",\n            )\n        })?;\n        Ok(Self {\n            request: RunRequestSummary {\n                project_id: ProjectId(value.project_id),\n                project_generation: ProjectGeneration(value.project_generation),\n                target: run_target_from_proto(target)?,\n                args_summary: value.args_summary,\n                options_summary: value.options_summary,\n            },\n            created_at_ms: value.created_at_ms,\n            time_anchor: RunTimeAnchor {\n                epoch_created_at_ms: time_anchor.epoch_created_at_ms,\n                trace_zero_ns: time_anchor.trace_zero_ns,\n            },\n        })","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_events/src/value/record.rs#L394-L430","documentation":"Thrown by TryFrom<pb::RunStartedV1> for RunStartedRecord when the protobuf message lacks `time_anchor` (the timestamp/anchor field). The record type requires it so all run events can be ordered against a common clock; a missing anchor makes the record unusable, so the conversion returns io::ErrorKind::InvalidData.","triggerScenarios":"RunStartedRecord::try_from on a RunStartedV1 whose time_anchor field is None — either never set by the producer or dropped during (de)serialization of the event stream.","commonSituations":"Producer code updated to a new schema where time_anchor moved/renamed and old emitters no longer populate it; fixtures that set target but forget time_anchor; clock/telemetry wiring omitted in a new run harness.","solutions":["Set time_anchor (set_time_anchor(pb::TimeAnchor{...})) on RunStartedV1 before serializing","Audit the emitter that created the event to ensure it records the time anchor","Reject or quarantine malformed records at decode time instead of failing the whole stream","Check schema versions between producer and consumer for dropped fields"],"exampleFix":"// before\nlet rec = RunStartedRecord::try_from(msg)?; // time_anchor None\n// after\nmsg.time_anchor = Some(pb::TimeAnchor { unix_nanos: now_ns });\nlet rec = RunStartedRecord::try_from(msg)?;","handlingStrategy":"validation","validationCode":"fn has_anchor(msg: &pb::RunStartedV1) -> bool { msg.time_anchor.is_some() }","typeGuard":"fn time_anchor(msg: &pb::RunStartedV1) -> Option<&pb::TimeAnchor> { msg.time_anchor.as_ref() }","tryCatchPattern":"match RunStartedRecord::try_from(msg) {\n    Ok(rec) => rec,\n    Err(e) if e.kind() == io::ErrorKind::InvalidData => { log::warn!(\"run-started missing anchor: {e}\"); Default::default() },\n    Err(e) => return Err(e),\n}","preventionTips":["Populate time_anchor at event creation time","Keep anchor-setting logic in one shared emitter helper","Validate events at the producer boundary before writing to the stream"],"tags":["protobuf","deserialization","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}