{"record":{"id":"f1488f404835e741","repo":"BoundaryML/baml","slug":"cancelled","errorCode":null,"errorMessage":"Cancelled: {}","messagePattern":"Cancelled: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"engine/baml-runtime/src/lib.rs","lineNumber":1071,"sourceCode":"                    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)) => {\n                        let value_with_constraints = value.0.map_meta(|m| m.1.clone());\n                        evaluate_test_constraints(","sourceCodeStart":1053,"sourceCodeEnd":1089,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/lib.rs#L1053-L1089","documentation":"In run_test_with_expr_events, LLMResponse::Cancelled(e) is converted to an error with the prefix 'Cancelled: '. This occurs when the LLM call was aborted — e.g., a cancel tripwire fired or the caller dropped/cancelled the future — before a final response was obtained. It distinguishes deliberate cancellation from genuine provider failures.","triggerScenarios":"Running an expr-function test while the cancellation token/tripwire is triggered (timeout, user abort, shutdown), so the runtime returns LLMResponse::Cancelled which the test harness surfaces as 'Cancelled: {reason}'.","commonSituations":"Test timeout hitting the cancel tripwire; Ctrl-C or task abort in the harness; a watchdog cancelling long-running LLM calls; nested runtimes shutting down streams.","solutions":["Remove the cancellation trigger or increase the timeout that cancelled the call","Avoid dropping/aborting the future mid-call unless cancellation is intended","Check that the cancel_tripwire/timeout configuration matches expected LLM latency","Retry the test without concurrent cancellation"],"exampleFix":"// before\nlet timeout = Duration::from_secs(1); // too short, call gets cancelled\n// after\nlet timeout = Duration::from_secs(60);","handlingStrategy":"try-catch","validationCode":"// Ensure the cancel tripwire is not pre-armed\nif cancel_tripwire.is_cancelled() {\n    return Err(anyhow!(\"tripwire already cancelled before test start\"));\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().starts_with(\"Cancelled:\") => eprintln!(\"test was cancelled: {e}\"),\n    other => other?,\n}","preventionTips":["Set timeouts comfortably above expected LLM latency","Don't abort test futures mid-call unless cancellation is intended","Treat Cancelled as operational state, not a provider failure"],"tags":["llm","cancellation","timeout","test-runner"],"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"}