BoundaryML/baml · error
{message}
Error message
{message} What it means
When a streamed LLM response fails, the orchestrator maps the error code: code Other(2) is treated as an internal BAML error and the raw message is bubbled up directly; any other code becomes a ClientHttpError. The displayed message is the underlying provider failure text.
Solutions
- Read the inner {message} to identify the actual BAML-internal failure
- Check media/file inputs are properly resolved (url/base64) before the call
- Validate the client configuration (api keys, model names) in clients.baml
- Update BAML if the message suggests an internal invariant failure, and file an issue if reproducible
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate media inputs are resolved before calling
function mediaReady(m) {
return m && (m.base64 != null || m.url != null);
} Type guard
const isInternalBamlError = (e) => /BAML internal error/i.test(String(e?.message ?? e));
Try / catch
try {
const res = await b.functions.F(input);
} catch (e) {
if (isInternalBamlError(e)) {
console.error('BAML internal failure:', String(e));
throw new Error('BAML internal error — check media/config, report if reproducible');
}
throw e;
} Prevention
- Resolve all media to base64/URL before calls
- Keep BAML runtime and CLI versions aligned
- Validate client config with `baml-cli` test generation
- Report reproducible internal errors upstream
When it happens
Trigger: A stream node returns a Failure with ErrorCode::Other(2) — BAML-internal errors such as prompt-render or client-construction failures surfaced during streaming.
Common situations: Internal BAML errors while building the request (bad media, config issues) surfacing mid-orchestration; provider SDK raising non-HTTP errors wrapped as Other(2).
Related errors
- BAML Internal error: Stream did not complete successfully…
- -32603
- AbortError
- AWS Bedrock modular streaming is not supported. Use…
- BAML internal error (Anthropic): file should have been…
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/cd32a3baacff9581.
Report an issue: GitHub.
Appendix: source
Thrown at engine/baml-runtime/src/internal/llm_client/orchestrator/stream.rs:429
message,
finish_reason: s.metadata.finish_reason.clone(),
}
)))
} else {
Some(parse_fn(&s.content))
}
}
LLMResponse::LLMFailure(LLMErrorResponse {
code,
client,
message,
raw_response,
..
}) => {
match code {
// This is some internal BAML error, so handle it like any other error
crate::internal::llm_client::ErrorCode::Other(2) => {
Some(Err(anyhow::anyhow!(message.clone())))
}
_ => Some(Err(anyhow::anyhow!(
crate::errors::ExposedError::ClientHttpError {
client_name: client.clone(),
message: message.clone(),
status_code: code.clone(),
detailed_message: message.clone(),
raw_response: raw_response.clone(),
}
))),
}
}
other => {
None
},
};
// parsed_response.map(|r| r.and_then(|v| parsed_value_to_response(v)));View on GitHub (pinned to bd85ce9dee)