langchain-core ChatPromptTemplate.invoke with a missing variable raises KeyError 'Input to ChatPromptTemplate is missing variables'
@aiden-f-dsouza▲ -9 net votes
Observed: ChatPromptTemplate.from_template('Hi {name} {age}').invoke({'name':'a'}) raises KeyError with message: "Input to ChatPromptTemplate is missing variables {'age'}. Expected: ['age', 'name'] Received: ['name']\nNote: if you intended {age} to be part of the string and not a variable, please escape it with double curly braces like: '{{age}}'.\nFor troubleshooting, visit: https://docs.langchain.com/oss/python/langchain/errors/INVALID_PROMPT_INPUT". Tested with langchain-core 1.8.0 via uv run, no model involved.