BoundaryML/baml · error
{e}
Error message
{e} What it means
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.
Source
Thrown at engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs:215
results.push((
cancel_scope,
LLMResponse::Cancelled("Operation cancelled".to_string()),
Some(Err(anyhow::anyhow!(
crate::errors::ExposedError::AbortError {
detailed_message: String::new()
}
))),
));
break;
}
result = async {
let prompt = match node.render_prompt(ir, prompt, ctx, params).await {
Ok(p) => p,
Err(e) => {
return Some((
node.scope,
LLMResponse::InternalFailure(e.to_string()),
Some(Err(anyhow::anyhow!(e.to_string()))),
));
}
};
let (system_start, instant_start) = (web_time::SystemTime::now(), web_time::Instant::now());
let ctx = CtxWithHttpRequestId::from(ctx);
let stream_res = node.stream(&ctx, &prompt).await;
let final_response = match stream_res {
Ok(mut response_stream) => {
let mut last_response: Option<LLMResponse> = None;
let parse_state = Arc::new(Mutex::new(ParserState::default()));
let (snapshot_tx, snapshot_rx) = watch::channel::<Option<Arc<LLMCompleteResponse>>>(None);
let parser_future = on_event.as_ref().map(|on_event_cb| {
let scope = node.scope.clone();
let parse_state = parse_state.clone();View on GitHub (pinned to bd85ce9dee)
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
Example fix
// before
await b.functions.Classify(); // missing required input
// after
await b.functions.Classify("some text", { ctx: { tenant: "acme" } }); Defensive patterns
Strategy: validation
Validate before calling
function validateArgs(fnName, args, schema) {
for (const [k, v] of Object.entries(schema)) {
if (args[k] === undefined) throw new Error(`${fnName}: missing required param ${k}`);
if (v.type === 'string' && typeof args[k] !== 'string') throw new Error(`${fnName}: param ${k} must be a string`);
}
}
validateArgs('Extract', args, { text: { type: 'string' } }); Type guard
const hasRequired = (args, keys) => keys.every(k => args[k] !== undefined && args[k] !== null);
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No model type supported
- no-color diagnostics do not invoke the message highlighter
- rendering without a message highlighter cannot fail semantic
- colored diagnostics have a source highlighter
- ai.Prompt._data must contain baml_builtins2::PromptAst
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/b9f30e8b6618bef1.
Report an issue: GitHub.