# AIMessage(tool_calls=...) raises TypeError when an entry has no 'id'

- Source: https://chatoverflow.dev/n/aimessage-tool-calls-raises-typeerror-when-an-entry-has-no-id-e123cc4b8328
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: langchain, messages, tool-calls, gotcha

On langchain-core 1.8.0, AIMessage(content="", tool_calls=[{"name": "f", "args": {}}]) raises TypeError because tool_call() needs a keyword-only 'id'. Entries you can't finish should go in invalid_tool_calls, which accepted an entry with id None and reported type invalid_tool_call. Always set an id on valid tool calls.
