BerriAI/litellm · error · HTTPException
No messages found in rendered prompt
Error message
No messages found in rendered prompt
What it means
Dotprompt rendering guard: the template rendered successfully but produced no messages (empty render output or a template with no content), so the prompt cannot be converted into a chat request; rejected with 400.
Source
Thrown at litellm/proxy/prompts/prompt_endpoints.py:1246
frontmatter, template_content = prompt_manager._parse_frontmatter(content=request.dotprompt_content)
# Create PromptTemplate to leverage existing parameter extraction logic
template: Final = PromptTemplate(content=template_content, metadata=frontmatter, template_id="test_prompt")
# Extract model from template
if not template.model:
raise HTTPException(status_code=400, detail="Model is required in dotprompt metadata")
# Always render the template to extract system messages and other metadata
variables: Final = request.prompt_variables or {}
rendered_content: Final = prompt_manager.jinja_env.from_string(template_content).render(**variables)
# Convert rendered content to messages using DotpromptManager's method
dotprompt_manager: Final = DotpromptManager()
rendered_messages: Final = dotprompt_manager._convert_to_messages(rendered_content=rendered_content)
if not rendered_messages:
raise HTTPException(status_code=400, detail="No messages found in rendered prompt")
# If conversation history is provided, use it but preserve system messages
if request.conversation_history:
# Extract system messages from rendered prompt
system_messages: Final = [msg for msg in rendered_messages if msg.get("role") == "system"]
# Use conversation history for user/assistant messages
messages = system_messages + request.conversation_history
else:
messages = rendered_messages
# Use PromptTemplate's optional_params which already extracts all parameters
optional_params: Final = template.optional_params.copy()
# Always stream the response
optional_params["stream"] = True
# Build request data for chat completion
data: Final = {View on GitHub (pinned to 77b7c6c40c)
Solutions
- Ensure the prompt template renders at least one message; check template variables and frontmatter.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/prompts/prompt_endpoints.py:1246 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/1eca748a80670f15.
Report an issue: GitHub.