LangChain errors / Schema
ValueError: System message must be at beginning of message list.
Cause
LangGraph appends a system message node after the user message is already in state, but the Anthropic API requires the system message to be first.
Fix
Bind the system prompt directly to the ChatAnthropic model via the system= parameter instead of inserting it as a graph node. Remove any initialize_system_prompt node and its edges. This ensures the system message is always first when sent to the API.
Part of the Automation Error Index — LangChain errors: browse all.
Hitting an automation error we have not covered?
AutomateLab builds and debugs n8n, Make, and agent workflows as fixed-scope projects. If something is broken in production, tell us what you are seeing.
Describe the problem