{"record":{"id":"b9f30e8b6618bef1","repo":"BoundaryML/baml","slug":"e-stream","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs","lineNumber":215,"sourceCode":"                results.push((\n                    cancel_scope,\n                    LLMResponse::Cancelled(\"Operation cancelled\".to_string()),\n                    Some(Err(anyhow::anyhow!(\n                        crate::errors::ExposedError::AbortError {\n                            detailed_message: String::new()\n                        }\n                    ))),\n                ));\n                break;\n            }\n            result = async {\n                let prompt = match node.render_prompt(ir, prompt, ctx, params).await {\n                    Ok(p) => p,\n                    Err(e) => {\n                        return Some((\n                            node.scope,\n                            LLMResponse::InternalFailure(e.to_string()),\n                            Some(Err(anyhow::anyhow!(e.to_string()))),\n                        ));\n                    }\n                };\n\n\n                let (system_start, instant_start) = (web_time::SystemTime::now(), web_time::Instant::now());\n                let ctx = CtxWithHttpRequestId::from(ctx);\n                let stream_res = node.stream(&ctx, &prompt).await;\n                let final_response = match stream_res {\n                    Ok(mut response_stream) => {\n\n                        let mut last_response: Option<LLMResponse> = None;\n                        let parse_state = Arc::new(Mutex::new(ParserState::default()));\n                        let (snapshot_tx, snapshot_rx) = watch::channel::<Option<Arc<LLMCompleteResponse>>>(None);\n\n                        let parser_future = on_event.as_ref().map(|on_event_cb| {\n                            let scope = node.scope.clone();\n                            let parse_state = parse_state.clone();","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs#L197-L233","documentation":"While orchestrating the stream, BAML renders the prompt for the current graph node; if rendering fails (missing/invalid params, context errors, template failures), the node yields LLMResponse::InternalFailure and the error string is propagated as-is. The message is the underlying render error, not an HTTP problem.","triggerScenarios":"A prompt node in the retry/orchestration graph fails render_prompt due to missing required function parameters, invalid context variables, or unresolvable Jinja-style expressions in the BAML prompt.","commonSituations":"Calling a BAML function without a required argument; passing a wrong-typed value (e.g. object where image expected); ctx variables referenced in the prompt not provided in the runtime context.","solutions":["Read the wrapped message {e} — it names the actual render failure","Ensure all required function parameters are supplied and correctly typed in the client call","Verify any ctx.* variables used in the prompt exist in the RuntimeContext passed in","Reproduce locally with a minimal call and print the params before invoking"],"exampleFix":"// before\nawait b.functions.Classify(); // missing required input\n// after\nawait b.functions.Classify(\"some text\", { ctx: { tenant: \"acme\" } });","handlingStrategy":"validation","validationCode":"function validateArgs(fnName, args, schema) {\n  for (const [k, v] of Object.entries(schema)) {\n    if (args[k] === undefined) throw new Error(`${fnName}: missing required param ${k}`);\n    if (v.type === 'string' && typeof args[k] !== 'string') throw new Error(`${fnName}: param ${k} must be a string`);\n  }\n}\nvalidateArgs('Extract', args, { text: { type: 'string' } });","typeGuard":"const hasRequired = (args, keys) => keys.every(k => args[k] !== undefined && args[k] !== null);","tryCatchPattern":null,"preventionTips":["Generate and use typed clients so missing params fail at compile time","Validate all prompt inputs before calling BAML functions","Supply every ctx.* variable referenced in prompts","Write a smoke test per function that renders the prompt"],"tags":["prompt","rendering","parameter"],"backgroundTag":"missing-required-argument","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}