BoundaryML/baml · error · anyhow::Error

User Failure: . Please report this error to our team with…

Error message

User Failure: {message}.
Please report this error to our team with BAML_LOG=info enabled so we can catch this error earlier and improve your development experience.

What it means

When the chain's LLMResponse is UserFailure, result_with_constraints_content raises an anyhow error noting the failure originated from user code (e.g. an abort() or explicit failure inside a BAML expression). The message asks users to report it with BAML_LOG=info so the failure path can be improved.

Solutions

  1. Read the embedded message to find why user code declared failure.
  2. Adjust the prompt/logic so the failure branch is not taken, or handle it intentionally.
  3. Reproduce with BAML_LOG=info to capture the full trace and, if unexpected, report to the BAML team.
Defensive patterns

Strategy: try-catch

Try / catch

match chain.content() {
    Ok(v) => Ok(v),
    Err(e) if e.to_string().starts_with("User Failure:") => handle_user_failure(e),
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: BAML function executed a UserFailure — e.g. `fail`/explicit failure semantics in the function body or a user-triggered abort recorded as LLMResponse::UserFailure — and the caller then reads the result.

Common situations: Prompts with conditional fail() branches that fired; check/assert logic deliberately failing the run; test harnesses exercising failure paths.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

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

                                    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."))
                    }
                    LLMResponse::Cancelled(message) => {
                        Err(anyhow::anyhow!(crate::errors::ExposedError::AbortError {
                            detailed_message: message.clone(),
                        }))
                    }
                    LLMResponse::Success(_) => {
                        Err(anyhow::anyhow!("This should never happen - Please report this error to our team with BAML_LOG=info enabled so we can improve this error message"))
                    }
                };
        };

        result
    }

View on GitHub (pinned to bd85ce9dee)