{"record":{"id":"0c31a76ba5886a91","repo":"BoundaryML/baml","slug":"llm-client-client-name-timed-out-message","errorCode":null,"errorMessage":"LLM client \"{client_name}\" timed out: {message}","messagePattern":"LLM client \"(.+?)\" timed out: (.+?)","errorType":"http","errorClass":"ExposedError::TimeoutError","httpStatus":408,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/orchestrator/call.rs","lineNumber":137,"sourceCode":"                                    message,\n                                    finish_reason: s.metadata.finish_reason.clone(),\n                                }\n                            )))\n                        } else {\n                            Some(parse_fn(&s.content))\n                        }\n                    }\n                    LLMResponse::LLMFailure(LLMErrorResponse {\n                        code,\n                        client,\n                        message,\n                        raw_response,\n                        ..\n                    }) => {\n                        match code {\n                            // Timeout error\n                            crate::internal::llm_client::ErrorCode::Timeout => {\n                                Some(Err(anyhow::anyhow!(\n                                    crate::errors::ExposedError::TimeoutError {\n                                        client_name: client.clone(),\n                                        message: message.clone(),\n                                    }\n                                )))\n                            }\n                            // This is some internal BAML error, so handle it like any other error\n                            crate::internal::llm_client::ErrorCode::Other(2) => {\n                                Some(Err(anyhow::anyhow!(message.clone())))\n                            }\n                            _ => Some(Err(anyhow::anyhow!(\n                                crate::errors::ExposedError::ClientHttpError {\n                                    client_name: client.clone(),\n                                    message: message.clone(),\n                                    status_code: code.clone(),\n                                    detailed_message: message.clone(),\n                                    raw_response: raw_response.clone(),\n                                }","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/orchestrator/call.rs#L119-L155","documentation":"BAML's orchestrator wraps LLM provider failures into typed ExposedError variants while executing a retry strategy. When a provider returns an LLMResponse::LLMFailure with ErrorCode::Timeout, the node converts it into ExposedError::TimeoutError carrying the client name and provider message. This means the configured LLM client did not answer within its timeout budget before BAML tried the next node in the strategy.","triggerScenarios":"Calling any BAML function (baml.Functions.MyFunc or b.Function) whose retry strategy invokes an LLM client that returns ErrorCode::Timeout - e.g. the HTTP request to the model provider exceeds the client's timeout_ms in clients.baml, or the provider library itself reports a timeout.","commonSituations":"Low timeout_ms values in clients.baml for slow models (large prompts, long generations, reasoning models); provider outages or rate-limit-induced slowness; network latency from a distant region or through a proxy; streaming disabled so the whole response must arrive before the deadline.","solutions":["Increase the client's timeout in clients.baml, e.g. client<TimedChat> { provider openai options { model gpt-4o timeout 120s } }.","Add a retry strategy with multiple clients so the orchestrator fails over to a faster/healthier provider when one times out.","Reduce prompt size or max_tokens / enable streaming so the response completes within the budget.","Check provider status pages and network connectivity (proxy, VPN) if timeouts are new.","Catch ExposedError::TimeoutError in the caller and apply backoff before retrying."],"exampleFix":"// before (clients.baml)\nclient<TimedChat> {\n  provider openai\n  options { model gpt-4o timeout 10s }\n}\n// after\nclient<TimedChat> {\n  provider openai\n  options { model gpt-4o timeout 120s }\n}\nretry_policy LongRetry {\n  max_retries 3\n  strategy { type exponential_backoff }\n}","handlingStrategy":"retry","validationCode":"// clients.baml sanity check before invoking\n// ensure client options include a timeout and a retry policy exists\n// client<\"gpt4\"> { provider openai options { timeout 120s } }","typeGuard":null,"tryCatchPattern":"// python\nfrom baml_py import BamlError, TimeoutError\ntry:\n    result = b.ExtractDocs(text)\nexcept TimeoutError as e:\n    log.warning(\"LLM client timed out, retrying: %s\", e)\n    result = b.ExtractDocs(text)  # or route to a fallback client\nexcept BamlError as e:\n    handle_other_baml_error(e)","preventionTips":["Set realistic timeout values based on measured p95 latency of your model/prompt size.","Always attach a retry_policy with fallback clients in the function definition.","Enable streaming for long generations so partial results arrive within budget.","Monitor provider status and alert on rising timeout rates."],"tags":["timeout","llm","network","retry"],"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"}