BoundaryML/baml · error
builtin function baml.fetch_value is not supported in…
Error message
builtin function baml.fetch_value is not supported in interpreter at {:?} What it means
The builtin `baml.fetch_value` requires network/runtime value-store access, which the THIR interpreter does not implement. Encountering Builtin::FetchValue during expression evaluation unconditionally raises "builtin function baml.fetch_value is not supported in interpreter". It is a deliberate capability gap, not a bug in your expression.
Solutions
- Refactor to pass the value as a function argument instead of calling baml.fetch_value inside interpreted code
- Resolve the value outside the interpreted expression and inject it via the environment/context
- Run the function through the normal compiled/runtime execution path instead of the interpreter
- Track BAML releases for interpreter support of fetch_value and upgrade when available
Example fix
// before
fn f() { baml.fetch_value("API_KEY") }
// after
fn f(api_key: string) { api_key } // caller resolves fetch_value and passes it in Defensive patterns
Strategy: fallback
Validate before calling
// Detect fetch_value usage before sending code to the interpreter
function usesFetchValue(code: string): boolean {
return code.includes("baml.fetch_value");
} Try / catch
try {
return interpreter.run(code, env);
} catch (e) {
if (String(e).includes("baml.fetch_value is not supported")) {
return runViaCompiledRuntime(code, env); // fallback to full runtime
}
throw e;
} Prevention
- Pass externally-fetched values as function parameters instead of calling fetch_value inside interpreted code
- Resolve dynamic config/secrets in the host language and inject them via the environment
- Keep fetch_value in functions executed on the compiled runtime path only
- Add a lint/grep gate that flags baml.fetch_value in interpreter-targeted code
When it happens
Trigger: Any interpreted evaluation (interpreter-based tests, runtime expression evaluation) that executes code containing a baml.fetch_value call.
Common situations: Using fetch_value to read runtime-provided values (secrets, dynamic config) inside a function that is then run through the interpreter; migrating code compiled to the normal runtime into an interpreter-based path.
Related errors
- arity mismatch: expected
- array access on non-list at
- array assignment index out of bounds
- array assignment on non-list value at
- array assignment requires a non-negative integer index at
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/0dfa7ed16ecad678.
Report an issue: GitHub.
Appendix: source
Thrown at engine/baml-compiler/src/thir/interpret.rs:2125
meta.0
),
}
}
}
}
EvalValue::Value(BamlValueWithMeta::Class(
name.clone(),
field_map,
meta.clone(),
))
}
Expr::Builtin(builtin, meta) => {
use crate::thir::Builtin;
match builtin {
Builtin::FetchValue => {
// FetchValue requires network access and is not supported in the interpreter
bail!(
"builtin function baml.fetch_value is not supported in interpreter at {:?}",
meta.0
)
}
}
}
Expr::BinaryOperation {
left,
operator,
right,
meta,
} => {
// Special handling for instanceof: right operand is a type name, not a value
if matches!(operator, crate::hir::BinaryOperator::InstanceOf) {
let left_val = expect_value(
evaluate_expr(
left,
scopes,View on GitHub (pinned to bd85ce9dee)