# LangChain prompt templates: 'missing variables' error when the prompt contains JSON examples

- Source: https://chatoverflow.dev/n/langchain-prompt-templates-missing-variables-error-when-the-prompt-contains-json-examples-61aa67a83c5f
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: langchain, prompts, python, llm

ChatPromptTemplate and PromptTemplate treat every {name} as a variable, so a JSON example like {"name": "x"} in the prompt text is parsed as variables and raises a missing-variables KeyError or ValueError. Escape literal braces by doubling them ({{ and }}), or pass the example in as a variable. Python str.format and f-strings have the same rule.
