{"record":{"id":"827e7f9e5db35b08","repo":"BoundaryML/baml","slug":"lib-827e7f","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/lib.rs","lineNumber":1069,"sourceCode":"                    on_event,\n                    ctx,\n                    type_builder.as_ref(),\n                    None,\n                    env_vars.clone(),\n                )\n                .await;\n            let res = response_res?;\n            let (_, llm_resp, val) = res\n                .event_chain()\n                .iter()\n                .last()\n                .context(\"Expected non-empty event chain\")?;\n            if let Some(expr_tx) = expr_tx {\n                expr_tx.unbounded_send(vec![]).unwrap();\n            }\n            let complete_resp = match llm_resp {\n                LLMResponse::Success(complete_llm_response) => Ok(complete_llm_response),\n                LLMResponse::InternalFailure(e) => Err(anyhow::anyhow!(\"{}\", e)),\n                LLMResponse::UserFailure(e) => Err(anyhow::anyhow!(\"{}\", e)),\n                LLMResponse::Cancelled(e) => Err(anyhow::anyhow!(\"Cancelled: {}\", e)),\n                LLMResponse::LLMFailure(e) => Err(anyhow::anyhow!({\n                    let scrubbed_opts =\n                        crate::redaction::scrub_baml_options(&e.request_options, &env_vars, false);\n                    format!(\n                        \"{} {}\\n\\nRequest options: {}\",\n                        e.code,\n                        e.message,\n                        serde_json::to_string(&scrubbed_opts).unwrap_or_default()\n                    )\n                })),\n            }?;\n            let test_constraints_result = if constraints.is_empty() {\n                TestConstraintsResult::empty()\n            } else {\n                match val {\n                    Some(Ok(value)) => {","sourceCodeStart":1051,"sourceCodeEnd":1087,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/lib.rs#L1051-L1087","documentation":"In run_test_with_expr_events, after awaiting the function run, the final LLM response is matched; LLMResponse::InternalFailure(e) is re-raised as anyhow::anyhow!(\"{}\", e). This propagates an internal (client/transport-side) failure that occurred while executing the LLM call for the test. The Display of the internal failure carries the underlying cause (e.g., HTTP/timeout/provider error).","triggerScenarios":"Running an expr-function test via run_test_with_expr_events when the LLM provider call ends in LLMResponse::InternalFailure — e.g., the request could not be completed due to transport, timeout, or client-internal error.","commonSituations":"Network outage or DNS failure during a test run; provider client misconfiguration (bad base URL); TLS errors; the HTTP client failing before a response status was received.","solutions":["Read the wrapped message for the underlying transport/client cause and fix that first","Verify network connectivity and proxy settings in the environment running the test","Check the LLM client configuration (base URL, TLS, provider settings) in .baml","Retry the test if the failure was transient"],"exampleFix":"// before\nlet resp = runtime.run_test_with_expr_events(...).await?; // panics on InternalFailure text\n// after\nmatch runtime.run_test_with_expr_events(...).await {\n    Ok(resp) => /* ... */,\n    Err(e) => eprintln!(\"LLM internal failure during test: {e:#}\"),\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Match the response variant before treating it as success\nmatch run_test_with_expr_events(...).await {\n    Ok(resp) => handle(resp),\n    Err(e) if e.to_string().contains(\"InternalFailure\") || is_transport(&e) => retry_with_backoff(),\n    Err(e) => report(e),\n}","preventionTips":["Add retry with exponential backoff for transient transport failures","Check connectivity/proxy settings in the environment running tests","Log the full error chain ({e:#}) to expose the underlying client cause"],"tags":["llm","internal-failure","network","test-runner"],"backgroundTag":"http-request-failed","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"}