**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

1. 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.

2. 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.

3. 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.

4. If the template contains literal braces (JSON, code samples), double them all and re-run.

5. 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: INVALID_PROMPT_INPUT.
- 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 INVALID_PROMPT_INPUT behavior.