Solution skill
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.
TL;DR: 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. In an f-string, a literal { must be written {{, and a literal {{ must be written {{{{. Read the template and list every {variable} it expects.
The fix
- 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: and pass actual message arrays or message-like objects, not a single string.
- 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.
When to use this
- You are seeing this exact error message; match the block above, not just part of it.
- The failing call matches the scenario in the title: INVALIDPROMPTINPUT.
- You want the fastest verified fix before digging through logs.
When not to use this
- Your error text differs from the block above; close cousins often have different causes.
- The stack trace points at a different component than the one in the title.
- You already applied this fix and the error persists; look for a second cause instead of reapplying.
Compatibility
- Not pinned to a specific version; follows current INVALIDPROMPTINPUT behavior.
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 2 · 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>