{"record":{"id":"5ea6205a7798266b","repo":"BoundaryML/baml","slug":"no-model-type-supported","errorCode":null,"errorMessage":"No model type supported","messagePattern":"No model type supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/internal/llm_client/traits/mod.rs","lineNumber":327,"sourceCode":"                    ctx,\n                    &chat,\n                )\n                .await?;\n                RenderedPrompt::Chat(chat)\n            }\n        };\n\n        let mut prompt = match (features.completion, features.chat) {\n            (true, false) => {\n                let options = self.completion_options(ctx)?;\n                prompt.as_completion(&options)\n            }\n            (false, true) => {\n                let options = self.chat_options(ctx)?;\n                prompt.as_chat(&options)\n            }\n            (true, true) => prompt,\n            (false, false) => anyhow::bail!(\"No model type supported\"),\n        };\n\n        if features.max_one_system_prompt {\n            // Do some more fixes.\n            if let RenderedPrompt::Chat(chat) = &mut prompt {\n                if chat.len() == 1 && chat[0].role == \"system\" {\n                    // If there is only one message and it is a system message, change it to a user message,\n                    // because these models always requires a user message.\n                    chat[0].role = \"user\".into();\n                } else {\n                    // Otherwise, proceed with the existing logic for other messages.\n                    chat.iter_mut().skip(1).for_each(|c| {\n                        if c.role == \"system\" {\n                            c.role = \"user\".into();\n                        }\n                    });\n                }\n            }","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/internal/llm_client/traits/mod.rs#L309-L345","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nfunction F() {\n  prompt #\"\"#   // empty prompt\n}\n\n// after\nfunction F() {\n  prompt #\"\n    Answer the question: {{ question }}\n    {{ ctx.output_format }}\n  \"#\n}","handlingStrategy":"validation","validationCode":"// Ensure the prompt renders to at least one mode before calling\nconst rendered = fn.prompt.render(testCtx);\nif (!rendered.chat.length && !rendered.completion) {\n  throw new Error('Prompt is empty; add content so it can render as chat or completion');\n}","typeGuard":"function isRenderable(p) { return p && ((p.chat && p.chat.length > 0) || !!p.completion); }","tryCatchPattern":"try { await b.F(args); } catch (e) { if (String(e).includes('No model type supported')) console.error('Fix empty/malformed prompt block'); }","preventionTips":["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"],"tags":["baml","prompt","rendering"],"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"}