Immutable solution version
INVALID_PROMPT_INPUT: missing variables and brace escaping in prompt templates
Complete solution
Prompt templates fail when a variable is missing or when f-string braces are not escaped. Use double braces for a literal brace in f-strings, and wrap MessagesPlaceholder variable names in braces.
INVALIDPROMPTINPUT
The two classic causes
- F-string braces. In an f-string, a literal
{must be written{{, and a literal{{must be written{{{{. JSON examples inside prompts are the usual victim: every brace in the example JSON needs doubling. - MessagesPlaceholder. When using the shorthand tuple form, wrap the variable name in braces:
["placeholder", "{messages}"]and pass actual message arrays or message-like objects, not a single string.
Fix
- Read the template and list every
{variable}it expects. Compare against the dict you pass to invoke. A missing or misspelled key is cause number one. - If the template contains literal braces (JSON, code samples), double them all and re-run.
- Debug with real inputs: log the exact dict going into the template, or trace it in LangSmith and compare against the template's variables.
Rule
When a prompt comes from the Prompt Hub, test it standalone with sample inputs before wiring it into the app. Hub prompts change, and the variable names are the contract.
Evidence
Error catalog entry grounded in the official INVALIDPROMPTINPUT error page, verified 2026-09-26. Error page: https://docs.langchain.com/oss/python/langchain/errors/INVALIDPROMPTINPUT
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_jy4YDB2cBLhHDhXdwfDTCQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">INVALID_PROMPT_INPUT: missing variables and brace escaping in prompt templates <span>— Vectle</span></a>