BoundaryML/baml · error
No model type supported
Error message
No model type supported
What it means
`render_prompt` selects a chat or completion rendering path based on whether the prompt is compatible with each mode. When a prompt supports neither chat nor completion rendering (`(false, false)`), BAML bails with this terse message instead of rendering.
Source
Thrown at engine/baml-runtime/src/internal/llm_client/traits/mod.rs:327
ctx,
&chat,
)
.await?;
RenderedPrompt::Chat(chat)
}
};
let mut prompt = match (features.completion, features.chat) {
(true, false) => {
let options = self.completion_options(ctx)?;
prompt.as_completion(&options)
}
(false, true) => {
let options = self.chat_options(ctx)?;
prompt.as_chat(&options)
}
(true, true) => prompt,
(false, false) => anyhow::bail!("No model type supported"),
};
if features.max_one_system_prompt {
// Do some more fixes.
if let RenderedPrompt::Chat(chat) = &mut prompt {
if chat.len() == 1 && chat[0].role == "system" {
// If there is only one message and it is a system message, change it to a user message,
// because these models always requires a user message.
chat[0].role = "user".into();
} else {
// Otherwise, proceed with the existing logic for other messages.
chat.iter_mut().skip(1).for_each(|c| {
if c.role == "system" {
c.role = "user".into();
}
});
}
}View on GitHub (pinned to bd85ce9dee)
Solutions
- Ensure the function defines a non-empty prompt block with valid interpolation syntax.
- Verify the prompt contains at least one chat message or completion text that the provider can render.
- Fix template syntax errors (unclosed `{{ }}`) that can leave the prompt unrenderable.
- Regenerate the client and re-test prompt rendering.
Example fix
// before
function F() {
prompt #""# // empty prompt
}
// after
function F() {
prompt #"
Answer the question: {{ question }}
{{ ctx.output_format }}
"#
} Defensive patterns
Strategy: validation
Validate before calling
// Ensure the prompt renders to at least one mode before calling
const rendered = fn.prompt.render(testCtx);
if (!rendered.chat.length && !rendered.completion) {
throw new Error('Prompt is empty; add content so it can render as chat or completion');
} Type guard
function isRenderable(p) { return p && ((p.chat && p.chat.length > 0) || !!p.completion); } Try / catch
try { await b.F(args); } catch (e) { if (String(e).includes('No model type supported')) console.error('Fix empty/malformed prompt block'); } Prevention
- Never leave a prompt block empty
- Check `{{ }}` interpolation syntax so the template renders non-empty
- Test prompt rendering locally with `baml-cli test` before deploying
When it happens
Trigger: A `RenderedPrompt`/prompt AST that implements neither `as_chat` nor `as_completion` — e.g. a malformed prompt definition whose contents can't be classified as either chat messages or a completion string.
Common situations: An empty or invalid prompt block in a .baml function (e.g. a prompt with no renderable content), or programmatic prompt construction that produced an empty prompt, combined with a provider expecting one of the two modes.
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
- {e}
- Completion prompts are not supported by this provider
- error while building HTTP request for function {function_nam
- compilation failed: {e:?}
- failed to serialize BAML bytecode: {e}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/5ea6205a7798266b.
Report an issue: GitHub.