{"record":{"id":"9df10a64fdced334","repo":"BoundaryML/baml","slug":"bamlimage-has-no-callable-attribute-args","errorCode":null,"errorMessage":"BamlImage has no callable attribute '{args:#?}'","messagePattern":"BamlImage has no callable attribute '(.+?)'","errorType":"exception","errorClass":"minijinja::Error (UnknownMethod)","httpStatus":null,"severity":"error","filePath":"engine/baml-lib/baml-types/src/minijinja.rs","lineNumber":85,"sourceCode":"        )\n    }\n}\n\n// Necessary for nested instances of MinijinjaBamlImage to get rendered correctly in prompts\n// See https://github.com/BoundaryML/baml/pull/855 for explanation\nimpl std::fmt::Debug for MinijinjaBamlMedia {\n    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {\n        std::fmt::Display::fmt(self, f)\n    }\n}\n\nimpl minijinja::value::Object for MinijinjaBamlMedia {\n    fn call(\n        self: &Arc<Self>,\n        _state: &minijinja::State<'_, '_>,\n        args: &[minijinja::value::Value],\n    ) -> Result<minijinja::value::Value, minijinja::Error> {\n        Err(minijinja::Error::new(\n            minijinja::ErrorKind::UnknownMethod,\n            format!(\"BamlImage has no callable attribute '{args:#?}'\"),\n        ))\n    }\n\n    fn render(self: &Arc<Self>, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        std::fmt::Display::fmt(self, f)\n    }\n}\n","sourceCodeStart":67,"sourceCodeEnd":95,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-lib/baml-types/src/minijinja.rs#L67-L95","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (in .baml prompt)\n{{ image.resize(512) }}\n// after\n{{ image }}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"{# Jinja: never call media objects #}\n{{ image }}","preventionTips":["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"],"tags":["jinja","templates","rust"],"backgroundTag":"unsupported-operation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}