{"record":{"id":"1c3f5a93e2cd41ea","repo":"BoundaryML/baml","slug":"vm-internal-error-0","errorCode":null,"errorMessage":"VM internal error: {0}","messagePattern":"VM internal error: (.+?)","errorType":"exception","errorClass":"EngineError","httpStatus":null,"severity":"critical","filePath":"baml_language/crates/bex_engine/src/lib.rs","lineNumber":819,"sourceCode":"    #[error(\"Function call with ID {call_id} not found\")]\n    FunctionCallNotFound { call_id: CallId },\n\n    #[error(\"Future with ID {future_id} not found\")]\n    FutureNotFound { future_id: FutureId },\n\n    #[error(\"Function not found: {name}\")]\n    FunctionNotFound { name: String },\n\n    /// Function exists, but its `FunctionKind` is not invokable as an\n    /// engine entry point. Only bytecode functions can be called via\n    /// [`BexEngine::call_function`] / [`BexEngine::call_function_bound_args`]:\n    /// native (`$rust_function`) entries would re-enter the VM through\n    /// `YieldToCall` with no bytecode frame to return to. Sysops + builtins\n    /// reach their natives from inside a calling bytecode body.\n    #[error(\"Function `{name}` is not invokable as an entry point (kind: {kind})\")]\n    NotInvokableAsEntry { name: String, kind: String },\n\n    #[error(\"VM internal error: {0}\")]\n    VmInternalError(bex_vm::errors::VmInternalError),\n\n    #[error(\"{}\", format_vm_internal_error(source, trace))]\n    TracedVmInternalError {\n        source: bex_vm::errors::VmInternalError,\n        trace: Vec<bex_vm::StackFrame>,\n    },\n\n    /// Either a BAML panic or a BAML error value.\n    #[error(\"{}\", format_unhandled_throw(value, trace))]\n    UnhandledThrow {\n        value: Box<BexExternalValue>,\n        trace: Vec<bex_vm::StackFrame>,\n    },\n\n    /// Clean process-termination request from `baml.sys.exit(code)`.\n    /// The caller is expected to honor this as the process exit code.\n    /// BAML `int` is `i64`, so the signal carries the full value; the","sourceCodeStart":801,"sourceCodeEnd":837,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_engine/src/lib.rs#L801-L837","documentation":"This wraps an internal VM error (bex_vm::errors::VmInternalError) that escaped to the engine boundary, meaning the bytecode interpreter reached a state its own invariants say should be impossible. It is a bug-report signal, not an error the BAML program can cause intentionally. The library throws it when the VM returns an internal error while executing a function call.","triggerScenarios":"Running a BAML function when the VM hits an internal invariant violation (e.g. malformed bytecode, stack corruption, a broken builtin contract). Not reachable through normal user code paths.","commonSituations":"Developers hit this after using a mismatched engine/VM crate version, after a compiler bug emitted bad bytecode, or when a custom native/sysop misbehaves. Usually surfaced via bug reports.","solutions":["Upgrade bex_engine and bex_vm to matching, latest versions","File a bug report with the full error message and the BAML source that triggered it","Try reproducing with a minimal BAML function to isolate the offending construct","Clear cached compiled artifacts and rebuild so stale bytecode is not reused"],"exampleFix":"// before: mismatched crate versions\nbex_engine = \"0.9\"\nbex_vm = \"0.8\"\n// after: aligned versions\nbex_engine = \"0.9\"\nbex_vm = \"0.9\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(EngineError::VmInternalError(e)) => log_bug_report(e),\n    Ok(v) => use(v),\n    Err(e) => handle(e),\n}","preventionTips":["Keep bex_engine and bex_vm versions in lockstep","Avoid relying on unreleased/experimental VM features","Rebuild cleanly after upgrading compiler crates"],"tags":["vm","internal-error","rust"],"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-14T05:17:10.506Z"}