Failure Index / Data & schema · critical · LangChain · OpenAI Agents SDK · CrewAI
Agent fails with TypeError / 'NoneType' object has no attribute
Something upstream returned None (or the wrong type) and a later step tried to use it like real data. The stack trace points at the victim, not the culprit — the None was born steps earlier.
The error
'NoneType' object has no attribute agent
TypeError langchain agent tool
agent None result previous stepRoot cause
A tool returned None on a not-found/error path instead of raising, or an optional field came back empty. Agents chain steps, so the None travels until some attribute access finally explodes far from its source.
The fix
Walk backwards from the crash: find which step first produced the None and why (usually an empty search result or a swallowed error). Handle the empty case explicitly at that step — return a clear error or a default.
Preventing it next time
Ban silent None returns in tools: raise on failure or return typed results. Empty is a result the agent should reason about, not a landmine for step 7.
pip install vorlo-trace · npm install vorlo-trace. Start free