BoundaryML/baml · error
run started record omitted target
Error message
run started record omitted target
What it means
This io::Error (InvalidData) is thrown by TryFrom<pb::RunStartedV1> for RunStartedRecord when the decoded protobuf message has no `target` field set. In proto3, optional message fields decode to None when absent, and the record type requires a target (which function/test is being run), so conversion fails fast rather than constructing a record with an unusable target.
Source
Thrown at baml_language/crates/bex_events/src/value/record.rs:406
reason: match value.reason {
CaptureLossReason::QueueFull => {
crate::value::pb::CaptureLossReason::QueueFull as i32
}
},
skipped_count: value.skipped_count,
call: value.call.map(Into::into),
message: value.message.clone(),
timestamp_ms: value.timestamp_ms,
}
}
}
impl TryFrom<crate::value::pb::RunStartedV1> for RunStartedRecord {
type Error = io::Error;
fn try_from(value: crate::value::pb::RunStartedV1) -> Result<Self, Self::Error> {
let target = value.target.ok_or_else(|| {
io::Error::new(
io::ErrorKind::InvalidData,
"run started record omitted target",
)
})?;
let time_anchor = value.time_anchor.ok_or_else(|| {
io::Error::new(
io::ErrorKind::InvalidData,
"run started record omitted time anchor",
)
})?;
Ok(Self {
request: RunRequestSummary {
project_id: ProjectId(value.project_id),
project_generation: ProjectGeneration(value.project_generation),
target: run_target_from_proto(target)?,
args_summary: value.args_summary,
options_summary: value.options_summary,
},View on GitHub (pinned to bd85ce9dee)
Solutions
- Ensure the producer sets target (set_target(pb::RunTargetV1{...})) on every RunStartedV1 before serializing
- Check which emitter wrote the event and fix it to populate the required field
- Regenerate or repair the corrupted event-stream segment so the field is present
- Handle the Err case at decode time and skip/report the malformed record instead of panicking
Example fix
// before
let rec = RunStartedRecord::try_from(msg)?; // msg.target unset -> InvalidData
// after
msg.target = Some(pb::RunTargetV1 { target: Some(run_target_v1::Target::Function(...)) });
let rec = RunStartedRecord::try_from(msg)?; Defensive patterns
Strategy: validation
Validate before calling
fn is_valid(msg: &pb::RunStartedV1) -> bool { msg.target.is_some() }
// only call try_from when true Type guard
fn has_target(msg: &pb::RunStartedV1) -> Option<&pb::RunTargetV1> { msg.target.as_ref() } Try / catch
match RunStartedRecord::try_from(msg) {
Ok(rec) => rec,
Err(e) if e.kind() == io::ErrorKind::InvalidData => { log::warn!("malformed run-started: {e}"); return; },
Err(e) => return Err(e),
} Prevention
- Always set target on RunStartedV1 before serializing
- Add producer-side assertions for required optional proto fields
- Round-trip test fixtures (serialize/parse/convert) in CI
When it happens
Trigger: Calling RunStartedRecord::try_from(pb_run_started) where the RunStartedV1 message was built without set_target(), or a serialized event was truncated/mutated so the target oneof is missing on decode.
Common situations: A producer of bex_events upgraded its protobuf schema and stopped populating target; hand-crafted test fixtures that only fill in time_anchor; a partial write/corruption of the event stream dropping the field.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- log event omitted call
- run started record omitted time anchor
- body record omitted log metadata
- value metadata omitted codec
- value metadata omitted availability
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/51c2a276e787c132.
Report an issue: GitHub.