{"record":{"id":"d963b01fee0a0c80","repo":"BoundaryML/baml","slug":"baml-internal-error-this-is-a-bug-in-baml-please-report-it","errorCode":null,"errorMessage":"\n\n========================================\nBAML Internal Error\n========================================\n\n{}\n\nThis is a bug in BAML. Please report it:\n- GitHub: https://github.com/BoundaryML/baml/issues\n- Discord: https://boundaryml.com/discord\n\nInclude this error message and steps to reproduce.\n========================================\n","messagePattern":"\n\n========================================\nBAML Internal Error\n========================================\n\n(.+?)\n\nThis is a bug in BAML\\. Please report it:\n- GitHub: https://github\\.com/BoundaryML/baml/issues\n- Discord: https://boundaryml\\.com/discord\n\nInclude this error message and steps to reproduce\\.\n========================================\n","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"languages/rust/baml/src/error.rs","lineNumber":201,"sourceCode":"\n/// Panics with a user-friendly error message for internal/unreachable errors.\n///\n/// This macro is used for situations that should never occur in practice -\n/// bugs in the FFI boundary, protocol mismatches, etc. The error message\n/// guides users to report the issue.\n///\n/// # Examples\n/// ```ignore\n/// // Simple message\n/// baml_unreachable!(\"unexpected null pointer\");\n///\n/// // With format args\n/// baml_unreachable!(\"unknown object type: {:?}\", obj_type);\n/// ```\n#[macro_export]\nmacro_rules! baml_unreachable {\n    ($($arg:tt)*) => {{\n        panic!(\n            \"\\n\\n\\\n            ========================================\\n\\\n            BAML Internal Error\\n\\\n            ========================================\\n\\n\\\n            {}\\n\\n\\\n            This is a bug in BAML. Please report it:\\n\\\n            - GitHub: https://github.com/BoundaryML/baml/issues\\n\\\n            - Discord: https://boundaryml.com/discord\\n\\n\\\n            Include this error message and steps to reproduce.\\n\\\n            ========================================\\n\",\n            format_args!($($arg)*)\n        )\n    }};\n}\n","sourceCodeStart":183,"sourceCodeEnd":216,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/languages/rust/baml/src/error.rs#L183-L216","documentation":"The baml_unreachable! macro panics with a formatted banner marking code that should be impossible to reach. It's a deliberate fail-fast for internal invariant violations, and instructs the developer to report the bug to BAML's GitHub or Discord.","triggerScenarios":"Any match arm or branch marked baml_unreachable!(...) being executed at runtime — e.g. baml_unreachable!(\"unknown object type: {:?}\", obj_type) when the runtime encounters an unhandled value variant or state.","commonSituations":"New enum variants added upstream but not yet handled in the Rust bindings; corrupted or version-mismatched serialized data introducing unexpected values; genuine BAML bugs.","solutions":["Capture the full panic message including the formatted payload — it identifies the unhandled case.","Upgrade to the latest baml crate version, which may handle the new variant.","Open an issue at https://github.com/BoundaryML/baml/issues with the message and reproduction steps (or ask on https://boundaryml.com/discord)."],"exampleFix":"// before (in user code)\nmatch value { _ => unreachable!() }\n// after: upgrade dependency and reproduce with a minimal .baml + input, then report\n// Cargo.toml\n// baml = \"<latest>\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let result = std::panic::catch_unwind(|| baml_runtime.run(...));\nif let Err(panic) = result {\n    let msg = panic.downcast_ref::<String>().cloned().unwrap_or_default();\n    if msg.contains(\"BAML Internal Error\") {\n        // capture msg, versions, and repro; file issue at BoundaryML/baml\n    }\n}","preventionTips":["Upgrade to the latest baml version before reporting.","Capture the full panic payload — it contains the unhandled value.","Reduce to a minimal .baml file + input for reproduction.","Report via GitHub issues or Discord as the banner instructs."],"tags":["rust","panic","internal","unreachable","baml"],"backgroundTag":"internal-invariant-violation","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"}