BoundaryML/baml · critical · EngineError

{}

Error message

{}

What it means

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.

Source

Thrown at baml_language/crates/bex_engine/src/lib.rs:822

    #[error("Future with ID {future_id} not found")]
    FutureNotFound { future_id: FutureId },

    #[error("Function not found: {name}")]
    FunctionNotFound { name: String },

    /// Function exists, but its `FunctionKind` is not invokable as an
    /// engine entry point. Only bytecode functions can be called via
    /// [`BexEngine::call_function`] / [`BexEngine::call_function_bound_args`]:
    /// native (`$rust_function`) entries would re-enter the VM through
    /// `YieldToCall` with no bytecode frame to return to. Sysops + builtins
    /// reach their natives from inside a calling bytecode body.
    #[error("Function `{name}` is not invokable as an entry point (kind: {kind})")]
    NotInvokableAsEntry { name: String, kind: String },

    #[error("VM internal error: {0}")]
    VmInternalError(bex_vm::errors::VmInternalError),

    #[error("{}", format_vm_internal_error(source, trace))]
    TracedVmInternalError {
        source: bex_vm::errors::VmInternalError,
        trace: Vec<bex_vm::StackFrame>,
    },

    /// Either a BAML panic or a BAML error value.
    #[error("{}", format_unhandled_throw(value, trace))]
    UnhandledThrow {
        value: Box<BexExternalValue>,
        trace: Vec<bex_vm::StackFrame>,
    },

    /// Clean process-termination request from `baml.sys.exit(code)`.
    /// The caller is expected to honor this as the process exit code.
    /// BAML `int` is `i64`, so the signal carries the full value; the
    /// caller clamps into its shell's range (typically 0..=255 on Unix).
    #[error("baml.sys.exit({code})")]
    Exit { code: i64 },

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Read the embedded stack trace to locate the failing BAML frame
  2. Upgrade bex_engine/bex_vm to matching latest versions
  3. Reduce the BAML program to the traced frame and report it upstream
  4. Rebuild from clean state to rule out stale artifacts
Defensive patterns

Strategy: try-catch

Try / catch

match result {
    Err(EngineError::TracedVmInternalError { source, trace }) => {
        report_with_trace(source, trace)
    }
    Ok(v) => use(v),
    Err(e) => handle(e),
}

Prevention

When it happens

Trigger: 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).

Common situations: Debugging sessions where tracing is on; CI runs with the traced error path; same root causes as plain VmInternalError (version skew, compiler/VM bugs).

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/d96d4d3249dcdb87. Report an issue: GitHub.