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

  1. Read the inner {message} to identify the actual BAML-internal failure
  2. Check media/file inputs are properly resolved (url/base64) before the call
  3. Validate the client configuration (api keys, model names) in clients.baml
  4. 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

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


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)