BoundaryML/baml · error · ExposedError

ExposedError::TimeoutError { client_name, message }

Error message

ExposedError::TimeoutError { client_name, message }

What it means

When the chain holds an LLMFailure with ErrorCode::Timeout, result_with_constraints_content converts it into ExposedError::TimeoutError carrying the client name and failure message. It signals the LLM provider did not respond within the configured timeout.

Source

Thrown at engine/baml-runtime/src/types/response.rs:130

        }
    }

    pub fn result_with_constraints_content(&self) -> Result<&ResponseBamlValue> {
        let Some(result) = self
            .result_with_constraints()
            .as_ref()
            .map(|res| match res {
                Ok(val) => Ok(val),
                Err(err) => Err(anyhow::anyhow!(self.format_last_error_with_details(err))),
            })
        else {
            // If we don't have a parsed result, check if we have an LLMFailure
            return match self.llm_response() {
                    LLMResponse::LLMFailure(err) => {
                        // Convert LLMFailure to appropriate error type
                        match &err.code {
                            crate::internal::llm_client::ErrorCode::Timeout => {
                                Err(anyhow::anyhow!(crate::errors::ExposedError::TimeoutError {
                                    client_name: err.client.clone(),
                                    message: err.message.clone(),
                                }))
                            }
                            crate::internal::llm_client::ErrorCode::Other(2) => {
                                Err(anyhow::anyhow!(err.message.clone()))
                            }
                            _ => Err(anyhow::anyhow!(
                                crate::errors::ExposedError::ClientHttpError {
                                    client_name: err.client.clone(),
                                    message: err.message.clone(),
                                    status_code: err.code.clone(),
                                    detailed_message: err.message.clone(),
                                    raw_response: err.raw_response.clone(),
                                }
                            )),
                        }
                    }

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Increase the timeout (timeout_ms) on the BAML client configuration for the affected provider.
  2. Retry with exponential backoff; consider enabling BAML's retry policy for timeout errors.
  3. Reduce prompt/output size or switch to a faster model/client to fit within the timeout.
  4. Catch ExposedError::TimeoutError and fail over to a secondary client/provider.

Example fix

// before
client "Gpt4" {
  provider openai
  // no timeout set / too low
}

// after
client "Gpt4" {
  provider openai
  options {
    timeout_ms 120000
  }
}
Defensive patterns

Strategy: retry

Try / catch

if err.to_string().contains("TimeoutError") {
    retry_with_backoff(|| call_baml(), 3);
}

Prevention

When it happens

Trigger: An LLM call in the chain failed with ErrorCode::Timeout (provider latency exceeded the client's timeout setting) and the caller then reads the result via result_with_constraints_content()/report.

Common situations: Slow models (long generations), very low timeout_ms in the client config, provider outages or network latency spikes, reasoning models that stream for minutes.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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