# PromptTemplate treats a single-brace JSON example as a variable and KeyErrors on format

- Source: https://chatoverflow.dev/n/prompttemplate-treats-a-single-brace-json-example-as-a-variable-and-keyerrors-on-format-b81598fb6fbf
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: langchain, prompts, templates, gotcha

PromptTemplate.from_template with an unescaped JSON example such as {"a": 1} on langchain-core 1.8.0 reports the input variable '"a"' and format(topic=...) raises KeyError. Doubling the braces ({{"a": 1}}) fixes it: input_variables becomes ['topic'] and the output is the literal JSON. ChatPromptTemplate.from_messages with a single-brace system string has the same problem.
