BoundaryML/baml · error

{}

Error message

{}

What it means

In run_test_with_expr_events, after awaiting the function run, the final LLM response is matched; LLMResponse::InternalFailure(e) is re-raised as anyhow::anyhow!("{}", e). This propagates an internal (client/transport-side) failure that occurred while executing the LLM call for the test. The Display of the internal failure carries the underlying cause (e.g., HTTP/timeout/provider error).

Source

Thrown at engine/baml-runtime/src/lib.rs:1069

                    on_event,
                    ctx,
                    type_builder.as_ref(),
                    None,
                    env_vars.clone(),
                )
                .await;
            let res = response_res?;
            let (_, llm_resp, val) = res
                .event_chain()
                .iter()
                .last()
                .context("Expected non-empty event chain")?;
            if let Some(expr_tx) = expr_tx {
                expr_tx.unbounded_send(vec![]).unwrap();
            }
            let complete_resp = match llm_resp {
                LLMResponse::Success(complete_llm_response) => Ok(complete_llm_response),
                LLMResponse::InternalFailure(e) => Err(anyhow::anyhow!("{}", e)),
                LLMResponse::UserFailure(e) => Err(anyhow::anyhow!("{}", e)),
                LLMResponse::Cancelled(e) => Err(anyhow::anyhow!("Cancelled: {}", e)),
                LLMResponse::LLMFailure(e) => Err(anyhow::anyhow!({
                    let scrubbed_opts =
                        crate::redaction::scrub_baml_options(&e.request_options, &env_vars, false);
                    format!(
                        "{} {}\n\nRequest options: {}",
                        e.code,
                        e.message,
                        serde_json::to_string(&scrubbed_opts).unwrap_or_default()
                    )
                })),
            }?;
            let test_constraints_result = if constraints.is_empty() {
                TestConstraintsResult::empty()
            } else {
                match val {
                    Some(Ok(value)) => {

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Read the wrapped message for the underlying transport/client cause and fix that first
  2. Verify network connectivity and proxy settings in the environment running the test
  3. Check the LLM client configuration (base URL, TLS, provider settings) in .baml
  4. Retry the test if the failure was transient

Example fix

// before
let resp = runtime.run_test_with_expr_events(...).await?; // panics on InternalFailure text
// after
match runtime.run_test_with_expr_events(...).await {
    Ok(resp) => /* ... */,
    Err(e) => eprintln!("LLM internal failure during test: {e:#}"),
}
Defensive patterns

Strategy: try-catch

Try / catch

// Match the response variant before treating it as success
match run_test_with_expr_events(...).await {
    Ok(resp) => handle(resp),
    Err(e) if e.to_string().contains("InternalFailure") || is_transport(&e) => retry_with_backoff(),
    Err(e) => report(e),
}

Prevention

When it happens

Trigger: Running an expr-function test via run_test_with_expr_events when the LLM provider call ends in LLMResponse::InternalFailure — e.g., the request could not be completed due to transport, timeout, or client-internal error.

Common situations: Network outage or DNS failure during a test run; provider client misconfiguration (bad base URL); TLS errors; the HTTP client failing before a response status was received.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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