BoundaryML/baml · error · RuntimeError

{0}

Error message

{0}

What it means

RuntimeError::Other is the catch-all variant of bex_project's runtime error enum: it wraps an arbitrary message string and displays it verbatim via #[error("{0}")]. The library raises it for runtime failures that have no dedicated variant, so the message itself is the only diagnostic.

Source

Thrown at baml_language/crates/bex_project/src/lib.rs:88

            required: m.into_iter().collect(),
            optional: IndexMap::new(),
        }
    }
}

impl From<IndexMap<String, BexExternalValue>> for BexArgs {
    fn from(required: IndexMap<String, BexExternalValue>) -> Self {
        Self {
            required,
            optional: IndexMap::new(),
        }
    }
}

/// Errors that can occur during runtime operations.
#[derive(Debug, Error)]
pub enum RuntimeError {
    #[error("{0}")]
    Other(String),

    #[error("Invalid argument: {name}")]
    InvalidArgument { name: String },

    #[error("{message}")]
    Compilation { message: String },

    #[error("{0}")]
    Engine(#[from] bex_engine::EngineError),

    #[error("Failed to convert result to owned value: {0}")]
    Access(#[from] bex_heap::AccessError),
}

/// True iff `err` wraps an engine cancellation panic.
///
/// Centralizes the cancellation-classification logic that bridges and the

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Read the embedded message string — it is the full diagnostic — and fix the condition it describes.
  2. Enable logging/trace output around the bex_project call to capture context for the Other error.
  3. Check whether an underlying error (engine, heap access) is being flattened into Other and handle that root cause directly.
  4. If the message indicates a library bug, reproduce with a minimal snippet and file an issue.
Defensive patterns

Strategy: try-catch

Type guard

fn is_other_error(err: &RuntimeError) -> Option<&str> {
    if let RuntimeError::Other(msg) = err { Some(msg) } else { None }
}

Try / catch

match project.run(op) {
    Ok(v) => v,
    Err(RuntimeError::Other(msg)) => {
        log::error!("bex_project runtime failure: {msg}");
        // act on the message text or surface it to the user
    }
    Err(e) => return Err(e.into()),
}

Prevention

When it happens

Trigger: Any bex_project runtime operation that fails with a condition not covered by InvalidArgument, Compilation, Engine, or Access errors and is reported via RuntimeError::Other(String) — e.g. project-level runtime setup or execution helpers returning an ad-hoc error string.

Common situations: Generic runtime failures surfaced through the project facade; glue code mapping miscellaneous failures into RuntimeError::Other; unexpected internal conditions during project run/eval calls.

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/652f30dce3361206. Report an issue: GitHub.