{"record":{"id":"22514955278bc0f6","repo":"BoundaryML/baml","slug":"boundary-id-must-be-16-bytes-got","errorCode":null,"errorMessage":"boundary id must be 16 bytes, got {}","messagePattern":"boundary id must be 16 bytes, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_events/src/value/record.rs","lineNumber":567,"sourceCode":"                helper: helper.clone(),\n            }),\n            RunTarget::Companion {\n                parent_boundary_id,\n                function_name,\n            } => Target::Companion(crate::value::pb::CompanionRunTargetV1 {\n                parent_boundary_id: parent_boundary_id.map(|id| id.as_bytes().to_vec()),\n                function_name: function_name.clone(),\n            }),\n            RunTarget::Internal { name } => {\n                Target::Internal(crate::value::pb::InternalRunTargetV1 { name: name.clone() })\n            }\n        }),\n    }\n}\n\nfn boundary_id_from_slice(value: &[u8]) -> io::Result<BoundaryId> {\n    let bytes: [u8; 16] = value.try_into().map_err(|_| {\n        io::Error::new(\n            io::ErrorKind::InvalidData,\n            format!(\"boundary id must be 16 bytes, got {}\", value.len()),\n        )\n    })?;\n    Ok(BoundaryId::from_bytes(bytes))\n}\n\nfn run_status_to_proto(status: RunStatus) -> crate::value::pb::RunStatus {\n    match status {\n        RunStatus::Pending => crate::value::pb::RunStatus::Pending,\n        RunStatus::Running => crate::value::pb::RunStatus::Running,\n        RunStatus::WaitingForInput => crate::value::pb::RunStatus::WaitingForInput,\n        RunStatus::WaitingForEnv => crate::value::pb::RunStatus::WaitingForEnv,\n        RunStatus::Cancelling => crate::value::pb::RunStatus::Cancelling,\n        RunStatus::Succeeded => crate::value::pb::RunStatus::Succeeded,\n        RunStatus::Failed => crate::value::pb::RunStatus::Failed,\n        RunStatus::Cancelled => crate::value::pb::RunStatus::Cancelled,\n        RunStatus::Panicked => crate::value::pb::RunStatus::Panicked,","sourceCodeStart":549,"sourceCodeEnd":585,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_events/src/value/record.rs#L549-L585","documentation":"boundary_id_from_slice requires the input byte slice to be exactly 16 bytes to build a BoundaryId (a 128-bit identifier, likely a UUID). Any other length is rejected with io::ErrorKind::InvalidData and the actual length in the message.","triggerScenarios":"Converting a Vec<u8>/byte slice from protobuf bytes fields into BoundaryId where the producer wrote a truncated, zero-length, or otherwise non-16-byte buffer.","commonSituations":"Older producer versions writing 8- or 32-byte ids; empty bytes field defaulting to empty vec in proto3; manual id generation not using 16-byte UUIDs.","solutions":["Ensure the producer always writes exactly 16 bytes (e.g. uuid::Uuid::as_bytes()) for boundary ids","Check for schema/version drift where id size changed between producer and consumer","Validate the byte length before calling try_into and surface a clearer upstream error","Regenerate/repair affected event records with correctly sized ids"],"exampleFix":"// before\nlet id = boundary_id_from_slice(&bytes)?; // bytes.len() == 32\n// after\nlet uuid = uuid::Uuid::new_v4();\nlet id = boundary_id_from_slice(uuid.as_bytes())?; // always 16 bytes","handlingStrategy":"validation","validationCode":"fn is_boundary_id(bytes: &[u8]) -> bool { bytes.len() == 16 }","typeGuard":"fn as_boundary_id(bytes: &[u8]) -> Option<[u8; 16]> { bytes.try_into().ok() }","tryCatchPattern":"match boundary_id_from_slice(&bytes) {\n    Ok(id) => id,\n    Err(e) if e.kind() == io::ErrorKind::InvalidData => { log::warn!(\"bad boundary id length: {e}\"); skip_record(); },\n    Err(e) => return Err(e),\n}","preventionTips":["Generate ids with a 16-byte source (uuid::Uuid) only","Type-sign byte fields in proto comments/docs as 16-byte UUIDs","Validate id length at the deserialization boundary before conversion"],"tags":["uuid","byte-length","deserialization"],"backgroundTag":"invalid-argument-format","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}