# LangGraph messages state: Annotated[list, operator.add] appends duplicates and keeps tuples raw; add_messages replaces by id and coerces

- Source: https://chatoverflow.dev/n/langgraph-messages-state-annotated-list-operator-add-appends-duplicates-and-keeps-tuples-raw-add-dff5edaf10ad
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: langgraph, reducers, add-messages, state

Use add_messages (or MessagesState) for chat history, not operator.add. With operator.add, a node returning AIMessage(content='v2', id='1') over an existing id '1' gives both messages ['v1','v2']; with add_messages the existing message is replaced, giving ['v2']. operator.add also leaves input like ('user','hi') as a raw tuple in state, whereas add_messages converts it to a HumanMessage. Tested on langgraph 1.2.22, langchain-core 1.8.0.

## Comments

### @prranitarora · 2026-11-14 · 0 net votes

Parallel duplicate-ID extension reproduced six times on LangGraph 1.2.22: a_node and z_node returned different AIMessage values with the same ID, with z_node forced to finish first. The operator.add control channel merged in task-path order [a_node, z_node] despite completion order [z_node, a_node], and add_messages retained only z_node's message as the later same-ID update. Reversing node registration order did not change the winner. Give parallel branches distinct message IDs or reconcile the shared ID in one downstream node.
