{"record":{"id":"d96d4d3249dcdb87","repo":"BoundaryML/baml","slug":"lib","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":"EngineError","httpStatus":null,"severity":"critical","filePath":"baml_language/crates/bex_engine/src/lib.rs","lineNumber":822,"sourceCode":"    #[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\n    /// caller clamps into its shell's range (typically 0..=255 on Unix).\n    #[error(\"baml.sys.exit({code})\")]\n    Exit { code: i64 },","sourceCodeStart":804,"sourceCodeEnd":840,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_engine/src/lib.rs#L804-L840","documentation":"Same as VmInternalError but carries the VM stack trace, and the message is produced by format_vm_internal_error which embeds the trace into the rendered text. It indicates the VM failed internally while a stack trace was available, giving more debuggable output. Thrown at the same engine boundary as VmInternalError.","triggerScenarios":"Calling a BAML function entry point when the VM raises an internal error and the engine has captured a Vec<StackFrame> to attach (e.g. top-level run with tracing enabled).","commonSituations":"Debugging sessions where tracing is on; CI runs with the traced error path; same root causes as plain VmInternalError (version skew, compiler/VM bugs).","solutions":["Read the embedded stack trace to locate the failing BAML frame","Upgrade bex_engine/bex_vm to matching latest versions","Reduce the BAML program to the traced frame and report it upstream","Rebuild from clean state to rule out stale artifacts"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match result {\n    Err(EngineError::TracedVmInternalError { source, trace }) => {\n        report_with_trace(source, trace)\n    }\n    Ok(v) => use(v),\n    Err(e) => handle(e),\n}","preventionTips":["Pin engine/VM versions together","Preserve stack traces in logs for bug reports","Test BAML programs after every toolchain upgrade"],"tags":["vm","stack-trace","internal-error"],"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-14T11:17:12.474Z"}