{"record":{"id":"21f37335b57f81aa","repo":"BoundaryML/baml","slug":"exposederror-timeouterror-client-name-message","errorCode":null,"errorMessage":"ExposedError::TimeoutError { client_name, message }","messagePattern":"ExposedError::TimeoutError (.+?)","errorType":"exception","errorClass":"ExposedError","httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/types/response.rs","lineNumber":130,"sourceCode":"        }\n    }\n\n    pub fn result_with_constraints_content(&self) -> Result<&ResponseBamlValue> {\n        let Some(result) = self\n            .result_with_constraints()\n            .as_ref()\n            .map(|res| match res {\n                Ok(val) => Ok(val),\n                Err(err) => Err(anyhow::anyhow!(self.format_last_error_with_details(err))),\n            })\n        else {\n            // If we don't have a parsed result, check if we have an LLMFailure\n            return match self.llm_response() {\n                    LLMResponse::LLMFailure(err) => {\n                        // Convert LLMFailure to appropriate error type\n                        match &err.code {\n                            crate::internal::llm_client::ErrorCode::Timeout => {\n                                Err(anyhow::anyhow!(crate::errors::ExposedError::TimeoutError {\n                                    client_name: err.client.clone(),\n                                    message: err.message.clone(),\n                                }))\n                            }\n                            crate::internal::llm_client::ErrorCode::Other(2) => {\n                                Err(anyhow::anyhow!(err.message.clone()))\n                            }\n                            _ => Err(anyhow::anyhow!(\n                                crate::errors::ExposedError::ClientHttpError {\n                                    client_name: err.client.clone(),\n                                    message: err.message.clone(),\n                                    status_code: err.code.clone(),\n                                    detailed_message: err.message.clone(),\n                                    raw_response: err.raw_response.clone(),\n                                }\n                            )),\n                        }\n                    }","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/types/response.rs#L112-L148","documentation":"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.","triggerScenarios":"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.","commonSituations":"Slow models (long generations), very low timeout_ms in the client config, provider outages or network latency spikes, reasoning models that stream for minutes.","solutions":["Increase the timeout (timeout_ms) on the BAML client configuration for the affected provider.","Retry with exponential backoff; consider enabling BAML's retry policy for timeout errors.","Reduce prompt/output size or switch to a faster model/client to fit within the timeout.","Catch ExposedError::TimeoutError and fail over to a secondary client/provider."],"exampleFix":"// before\nclient \"Gpt4\" {\n  provider openai\n  // no timeout set / too low\n}\n\n// after\nclient \"Gpt4\" {\n  provider openai\n  options {\n    timeout_ms 120000\n  }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err.to_string().contains(\"TimeoutError\") {\n    retry_with_backoff(|| call_baml(), 3);\n}","preventionTips":["Set a realistic timeout_ms for slow/reasoning models","Enable BAML retry policies for timeout error codes","Configure a fallback client for latency-sensitive paths","Monitor provider latency and right-size generation length"],"tags":["timeout","llm","network"],"backgroundTag":"request-timeout","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"}