{"record":{"id":"f5fe5d9482fed719","repo":"BoundaryML/baml","slug":"self-n-ndetailed-message-detailed-message","errorCode":null,"errorMessage":"{self}\\n\\nDetailed message: {detailed_message}","messagePattern":"(.+?)\\\\n\\\\nDetailed message: (.+?)","errorType":"exception","errorClass":"ExposedError","httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/errors.rs","lineNumber":63,"sourceCode":"\n    pub fn to_anyhow_with_details(&self) -> anyhow::Error {\n        let detailed_message = match self {\n            ExposedError::ValidationError {\n                detailed_message, ..\n            } => detailed_message,\n            ExposedError::FinishReasonError {\n                detailed_message, ..\n            } => detailed_message,\n            ExposedError::ClientHttpError {\n                detailed_message, ..\n            } => detailed_message,\n            ExposedError::TimeoutError { message, .. } => message,\n            ExposedError::AbortError {\n                detailed_message, ..\n            } => detailed_message,\n        };\n        let with_details = format!(\"{self}\\n\\nDetailed message: {detailed_message}\");\n        anyhow::anyhow!(with_details)\n    }\n}\n\nimpl std::error::Error for ExposedError {}\n\nimpl std::fmt::Display for ExposedError {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        match self {\n            ExposedError::ValidationError {\n                prompt,\n                raw_output,\n                message,\n                detailed_message: _,\n            } => {\n                write!(\n                    f,\n                    \"Parsing error: {message}\\nPrompt: {prompt}\\nRaw Response: {raw_output}\"\n                )","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/errors.rs#L45-L81","documentation":"ExposedError::to_anyhow_with_details converts an ExposedError (Timeout, Abort, etc.) into an anyhow::Error, appending a more verbose detailed_message (present on some variants like AbortError) to the standard Display output. This is a formatting/conversion of an LLM call failure rather than a new failure itself.","triggerScenarios":"Any caller that invokes to_anyhow_with_details on an ExposedError — typically when surfacing a failed LLM request (timeout, abort, provider error) up through anyhow-based error chains in the runtime.","commonSituations":"A provider request times out or is aborted mid-stream and the runtime reports the full detailed message; users see the concise error plus 'Detailed message:' with provider-side diagnostics (rate limits, content filter, incomplete responses).","solutions":["Read the 'Detailed message:' section — it usually contains the provider's own diagnostic (rate limit, content filter, cancellation reason).","For TimeoutError: increase timeout settings in the client options or reduce prompt/output size.","For AbortError: check whether the request was cancelled (client disconnect, max retries) and adjust retry/finish reasons handling.","Inspect the underlying finish_reason/finish_reason_raw on the error struct for programmatic handling."],"exampleFix":"// before\nlet result = client.chat(messages)?; // panics/aborts with terse message\n// after\nmatch client.chat(messages) {\n    Ok(r) => r,\n    Err(e) => {\n        if e.to_string().contains(\"Detailed message\") {\n            eprintln!(\"LLM call failed: {e}\"); // includes provider details\n        }\n        return Err(e);\n    }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_timeout_or_abort(err: &anyhow::Error) -> bool {\n    let s = err.to_string();\n    s.contains(\"Timeout\") || s.contains(\"Abort\")\n}","tryCatchPattern":"match client.chat(messages) {\n    Ok(r) => r,\n    Err(e) => {\n        let msg = e.to_string();\n        let detailed = msg.split(\"Detailed message:\").nth(1).unwrap_or(\"\").trim();\n        if msg.contains(\"TimeoutError\") {\n            retry_with_backoff(3);\n        } else if msg.contains(\"AbortError\") {\n            log::warn!(\"request aborted: {detailed}\");\n        }\n        return Err(e);\n    }\n}","preventionTips":["Set generous but bounded timeouts in client options for long LLM calls.","Inspect the Detailed message section for provider-specific causes before retrying.","Distinguish Timeout from Abort errors to decide retry vs fail-fast.","Log the full anyhow chain so finish reasons and provider diagnostics are preserved."],"tags":["rust","llm","timeout","abort","error-conversion"],"backgroundTag":"upstream-api-error","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"}