{"record":{"id":"d341c2384312221d","repo":"BoundaryML/baml","slug":"unknown-run-error-class-other","errorCode":null,"errorMessage":"unknown run error class: {other}","messagePattern":"unknown run error class: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_events/src/value/record.rs","lineNumber":599,"sourceCode":"        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,\n    }\n}\n\nfn run_error_from_proto(value: crate::value::pb::RunErrorV1) -> io::Result<RunError> {\n    Ok(RunError {\n        class: match value.class.as_str() {\n            \"validation\" => RunErrorClass::Validation,\n            \"runtime\" => RunErrorClass::Runtime,\n            \"host\" => RunErrorClass::Host,\n            \"panic\" => RunErrorClass::Panic,\n            \"cancelled\" => RunErrorClass::Cancelled,\n            \"internal\" => RunErrorClass::Internal,\n            other => {\n                return Err(io::Error::new(\n                    io::ErrorKind::InvalidData,\n                    format!(\"unknown run error class: {other}\"),\n                ));\n            }\n        },\n        message: value.message,\n        details: value.details,\n        value_ref: value.value_ref.map(ValueRef::try_from).transpose()?,\n    })\n}\n\nfn run_error_to_proto(value: &RunError) -> crate::value::pb::RunErrorV1 {\n    crate::value::pb::RunErrorV1 {\n        class: match value.class {\n            RunErrorClass::Validation => \"validation\",\n            RunErrorClass::Runtime => \"runtime\",\n            RunErrorClass::Host => \"host\",\n            RunErrorClass::Panic => \"panic\",","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_events/src/value/record.rs#L581-L617","documentation":"run_error_class_from_proto (string-to-enum mapping) rejects any class string it does not recognize with InvalidData, listing the offending value. Known classes are runtime, host, panic, cancelled, internal; anything else (e.g. a new producer-side class or typo) fails the conversion.","triggerScenarios":"TryFrom of a run-error record whose `class` string is not one of the five known variants — new enum values added upstream without updating this match, typos, or case mismatches (\"Runtime\" vs \"runtime\").","commonSituations":"Producer and consumer built from different schema versions where a new error class was added; hand-edited event payloads; localization/formatting of class strings before sending.","solutions":["Update the match arms in record.rs to handle the new class string","Align producer to only emit the known class strings (lowercase, exact spelling)","Normalize/whitelist class strings at the producer boundary before serialization","Bump/sync the shared schema so both sides agree on the enum"],"exampleFix":"// before\nmatch s.as_str() {\n    \"runtime\" => ..., \"internal\" => ..., other => return Err(...)\n}\n// after\nmatch s.as_str() {\n    \"runtime\" => ..., \"internal\" => ..., \"oom\" => RunErrorClass::Oom, other => return Err(...)\n}","handlingStrategy":"validation","validationCode":"const KNOWN: &[&str] = &[\"runtime\",\"host\",\"panic\",\"cancelled\",\"internal\"];\nfn is_known_class(s: &str) -> bool { KNOWN.contains(&s) }","typeGuard":null,"tryCatchPattern":"match convert_run_error(msg) {\n    Ok(rec) => rec,\n    Err(e) if e.to_string().starts_with(\"unknown run error class\") => { log::warn!(\"{e}\"); treat_as_internal(); },\n    Err(e) => return Err(e),\n}","preventionTips":["Keep the class string enum in one shared schema module","Map unknown producer classes to a fallback (internal) before emitting","Add cross-version compatibility tests for the class mapping"],"tags":["enum","string-mapping","schema-drift"],"backgroundTag":"invalid-enum-value","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"}