BoundaryML/baml · error · anyhow::Error
(LLM failure code Other(2))
Error message
{err.message} (LLM failure code Other(2)) What it means
For an LLMFailure with ErrorCode::Other(2), result_with_constraints_content surfaces the raw failure message directly via anyhow, without wrapping it in an ExposedError variant. Other(2) is a sentinel code BAML uses for provider-specific/uncategorized failures whose message is already user-facing.
Solutions
- Read the surfaced message — it reflects the provider's own error text; address what it says (e.g. adjust prompt to pass content filters).
- Enable BAML_LOG=debug to see the full raw request/response for the failing call.
- Add retry/fallback logic for transient provider failures.
Defensive patterns
Strategy: try-catch
Try / catch
match chain.content() {
Ok(v) => Ok(v),
Err(e) => { log::warn!("provider failure: {e}"); fallback_client_call() }
} Prevention
- Run with BAML_LOG=debug in development to see raw provider responses
- Adjust prompts to avoid content-filter refusals
- Add fallback clients for provider-specific failures
When it happens
Trigger: Reading the result of a chain whose LLM call failed with ErrorCode::Other(2) — provider-side errors that BAML maps to this sentinel (e.g. content-filter or provider-reported failures).
Common situations: Provider content-policy refusals, provider 4xx responses BAML maps to Other(2), malformed provider responses that surface as a plain message.
Related errors
- AbortError
- BamlAbortError: Operation was aborted
- BamlError: BamlClientError: BamlClientFinishReasonError
- BamlError: BamlClientError: BamlClientHttpError
- BamlError: BamlClientError: BamlTimeoutError
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/8ccbc2742222cf08.
Report an issue: GitHub.
Appendix: source
Thrown at engine/baml-runtime/src/types/response.rs:136
.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(),
}
)),
}
}
LLMResponse::UserFailure(message) => {
Err(anyhow::anyhow!("User Failure: {message}.\nPlease report this error to our team with BAML_LOG=info enabled so we can catch this error earlier and improve your development experience."))
}
LLMResponse::InternalFailure(message) => {
Err(anyhow::anyhow!("Internal Failure: {message}.\nThis should not happen - please report this error to our team with BAML_LOG=info enabled so we can catch this error earlier and improve your development experience."))
}View on GitHub (pinned to bd85ce9dee)