{"record":{"id":"3a5e3f5cde2da97a","repo":"BoundaryML/baml","slug":"llm-client-error-message","errorCode":null,"errorMessage":"LLM client error: {message}","messagePattern":"LLM client error: (.+?)","errorType":"exception","errorClass":"VmBamlError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_vm_types/src/errors.rs","lineNumber":137,"sourceCode":"    #[error(\"I/O error: {message}\")]\n    Io { message: String },\n\n    #[error(\"timeout: {message}\")]\n    Timeout {\n        message: String,\n        duration_ms: Option<i64>,\n    },\n\n    #[error(\"unsupported: {message}\")]\n    Unsupported { message: String },\n\n    #[error(\"access error: {message}\")]\n    AccessError { message: String },\n\n    #[error(\"render prompt: {message}\")]\n    RenderPrompt { message: String },\n\n    #[error(\"LLM client error: {message}\")]\n    LlmClient { message: String },\n\n    /// An error value from the host language that has no direct BAML\n    /// representation. The `handle` is the load-bearing field — it\n    /// references the original host exception object via the\n    /// process-global host-value table, so the originating runtime can\n    /// recover the exact native exception on round-trip. The\n    /// `class_name` / `message` / `language` / `traceback` fields are\n    /// purely metadata for debugging, logging, and user-facing\n    /// formatting — they do not participate in error matching or\n    /// rehydration.\n    ///\n    /// Surfaces in BAML as a `baml.errors.HostCallable` Instance whose\n    /// `_handle` field is materialized from `handle`. Engine-side\n    /// failures with no underlying host exception (bridge serialization\n    /// faults, missing-bridge errors, etc.) MUST use a different\n    /// variant — they are not host-language errors and have nothing to\n    /// rehydrate. Such SDK/bridge faults route through fatal","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_vm_types/src/errors.rs#L119-L155","documentation":"This is the LlmClient variant of the VM error enum. It wraps any failure raised by the underlying LLM client layer — connection errors, HTTP failures from the model provider, client misconfiguration, streaming failures — after the prompt was rendered and dispatched. The VM surfaces it so callers can distinguish LLM-layer problems from prompt/VM-layer problems.","triggerScenarios":"Calling a BAML function whose provider call fails: invalid or missing API key, unreachable provider endpoint, provider returning a non-success status, timeouts, malformed client config (bad model name, bad base_url).","commonSituations":"Expired or rotated API keys; provider outages or rate limiting; wrong base_url for self-hosted/proxied endpoints; model name changes after provider deprecations.","solutions":["Verify the provider API key/credentials are present and valid for the configured client.","Check the provider status page and retry with backoff if it is an outage or rate limit.","Validate the client config (model name, base_url, provider options) against the provider's current API.","Enable BAML/provider logging to inspect the exact HTTP request and response that failed."],"exampleFix":"// before\nclient<llm> Gpt4 {\n  provider openai\n  model gpt-4-0613 // deprecated/removed model\n}\n// after\nclient<llm> Gpt4 {\n  provider openai\n  model gpt-4o\n  options { api_key env.OPENAI_API_KEY }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match vm_result {\n    Err(BexError::LlmClient { message }) => {\n        if is_transient(&message) { backoff_retry()?; }\n    }\n    other => other?,\n}","preventionTips":["Validate provider API keys and base_url config at startup.","Pin model names and check provider deprecation notices.","Add retries with exponential backoff for transient HTTP failures.","Log full request/response on failure to speed diagnosis."],"tags":["baml","llm-client","network","api"],"backgroundTag":"api-error-response","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}