Skip to main content

Troubleshooting

Common failure modes across this section, and where to go for the full explanation.

SymptomLikely causeFix
ImportError / ModuleNotFoundError for a class that "used to work"Following a pre-1.x tutorial; the class moved to langchain-community or was renamed in the 0.x → 1.x splitCheck the migration table for the current import path.
RateLimitError from the providerToo many requests too fast, especially from a wide batch callLower max_concurrency, add retries and fallbacks.
Context-length / token-limit errorChat history grew unbounded over a long conversationApply trimming or summarization.
Retriever returns nothing relevantChunking or embedding mismatch, not a prompt problemPrint retriever.invoke(question) directly and inspect it — see the pitfall note in RAG Pipeline; also check the query and index used the same embedding model.
Model never calls a tool it clearly has access toVague tool name or docstringRewrite the description — see the pitfall note in Custom Tools.
with_structured_output raises or returns parsing_errorSchema too large, too nested, or ambiguous for the modelFlatten the schema, add field descriptions — see Structured Output and the failure-routing pattern in Structured Extraction.
Agent loops until it hits a step limit or your budgetRouter never returns END, or the model keeps re-requesting the same toolSet an explicit recursion/step limit — see the pitfall note in Conditional Edges.
Chain hangs, no tokens stream until the very endA non-streaming step (e.g. an output parser) sits in the middle of the chain and buffers everything behind itSee the buffering-barrier explanation in Streaming.
tip

Most of these stop being mysterious once you look at the actual data flowing through the chain — a trace in LangSmith shows the exact input and output at every step, which is usually faster than guessing from the final error.

See also