BoundaryML/baml · error · minijinja::Error (UnknownMethod)
BamlImage has no callable attribute '{args:#?}'
Error message
BamlImage has no callable attribute '{args:#?}' What it means
MinijinjaBamlMedia implements minijinja::value::Object, and its call method is intentionally unimplemented: BamlImage/BAML media values are data, not callable. Attempting to invoke a BAML media object like a function inside a Jinja template raises UnknownMethod with this message.
Source
Thrown at engine/baml-lib/baml-types/src/minijinja.rs:85
)
}
}
// Necessary for nested instances of MinijinjaBamlImage to get rendered correctly in prompts
// See https://github.com/BoundaryML/baml/pull/855 for explanation
impl std::fmt::Debug for MinijinjaBamlMedia {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
std::fmt::Display::fmt(self, f)
}
}
impl minijinja::value::Object for MinijinjaBamlMedia {
fn call(
self: &Arc<Self>,
_state: &minijinja::State<'_, '_>,
args: &[minijinja::value::Value],
) -> Result<minijinja::value::Value, minijinja::Error> {
Err(minijinja::Error::new(
minijinja::ErrorKind::UnknownMethod,
format!("BamlImage has no callable attribute '{args:#?}'"),
))
}
fn render(self: &Arc<Self>, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
std::fmt::Display::fmt(self, f)
}
}
View on GitHub (pinned to bd85ce9dee)
Solutions
- Remove the call — pass the media value directly to the parameter (e.g. {{ myImage }} or just bind it as the argument).
- Access properties instead of invoking: use fields like url, media_type, base64 as applicable.
- Check the template for typos where a helper function name was replaced by the media variable.
Example fix
// before (in .baml prompt)
{{ image.resize(512) }}
// after
{{ image }} Defensive patterns
Strategy: validation
Try / catch
{# Jinja: never call media objects #}
{{ image }} Prevention
- Never invoke BAML media values in templates; bind them directly as arguments
- Review templates for accidental function-call syntax on media variables
- Consult generated docs for media object properties instead of guessing methods
When it happens
Trigger: Calling a BamlImage/BamlMedia value in a prompt template, e.g. {{ myImage(...) }} or {{ myImage.myMethod() }} where the attribute resolves to the media object itself being invoked.
Common situations: Prompt templates written as if media objects exposed methods (resize, url(), etc.); typo'd property access that Jinja interprets as a call; copy-pasted template code from object-returning helpers.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Encountered impossible jinja expression during parsing
- Failed to parse template '{}': {}
- Failed to get template '{}': {}
- Jinja expressions cannot be resolved without a template cont
- Template string call '{}' cannot be resolved without IR cont
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/9df10a64fdced334.
Report an issue: GitHub.