/langchain-py-pack:langchain-common-errorsfrom langchain-py-pack
Troubleshoots 14 specific LangChain 1.0/LangGraph 1.0 exceptions by matching traceback messages to named causes and fixes. Includes a triage decision tree.
Ships in langchain-py-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
The same twelve-plus LangChain 1.0 / LangGraph 1.0 tracebacks show up every week
in production: ImportError: cannot import name 'ChatOpenAI' from 'langchain.chat_models',
AttributeError: 'list' object has no attribute 'lower', GraphRecursionError: Recursion limit of 25 reached, TypeError: Object of type datetime is not JSON serializable, KeyError: 'question' deep in LCEL internals. Stack traces are
ambiguous, docs sprawl across 0.2 / 0.3 / 1.0 eras, and engineers lose
30–90 minutes per incident re-deriving the fix.
This skill is a paste-match catalog of 14 entries (E01–E14) grouped into
3 reference files by category, plus a triage decision tree. Every entry opens
with the exact exception class and message string you see in your terminal,
names the cause in one sentence with a pain-catalog code, and gives a one-line
fix or a reference-file pointer. Pinned to langchain-core 1.0.x,
langchain 1.0.x, langgraph 1.0.x, verified 2026-04-21.
Pain-catalog anchors: P02, P06, P09, P10, P16, P17, P38, P39, P40, P41, P42, P55, P56, P57, P66.
langchain-core >= 1.0, < 2.0, langgraph >= 1.0, < 2.0, and any provider
integration packages pinned to 1.0.xanthropic >= 0.42 when using langchain-anthropic 1.0 (see E06)docs/pain-catalog.md for the exception class name or
a message substring. Do not add speculative fixes here without catalog evidence.Each entry is indexed as E## — ClassName: "message pattern" with a one-line cause (pain-catalog code) and a one-line fix or reference pointer.
Full detail, before/after code, codemod commands: import-migration.md.
ImportError: cannot import name 'ChatOpenAI' from 'langchain.chat_models'langchain.chat_models / langchain.llms re-exports removed in 1.0 (P38).from langchain_openai import ChatOpenAI. Run python -m langchain_cli migrate for automated rewrites. See E01 in import-migration.md.AttributeError: module 'langchain' has no attribute 'LLMChain'LLMChain, SequentialChain, TransformChain) removed in 1.0 in favor of LCEL (P39).chain = prompt | llm | StrOutputParser(); .run(x) becomes .invoke({"input": x}). See E02 in import-migration.md.ImportError: cannot import name 'ConversationBufferMemory'InMemorySaver / PostgresSaver + thread_id via LangGraph create_react_agent. See E03 in import-migration.md.ImportError: cannot import name 'initialize_agent'initialize_agent, AgentType, create_openai_functions_agent) removed in 1.0 (P41).from langgraph.prebuilt import create_react_agent; create_react_agent(model=llm, tools=tools, checkpointer=InMemorySaver()). See E04 in import-migration.md.AttributeError: 'AgentAction' object has no attribute 'tool_name' (or inverse)AgentAction / AgentFinish shape replaced by ToolCall objects; fields renamed .tool → .tool_name, .tool_input → .args (P42).tool_call["name"] / tool_call["args"] on message .tool_calls, not result["intermediate_steps"]. See E05 in import-migration.md.KeyError: 'input' inside tool_use block parsinglangchain-anthropic >= 1.0 requires anthropic >= 0.40; SDK tool-use schema changed (P66).pip install "langchain-anthropic>=1.0,<2.0" "anthropic>=0.42,<1.0" in the same commit. See E06 in import-migration.md.Full detail, block-iterator extractor, jinja2 escape pattern: content-shape.md.
AttributeError: 'list' object has no attribute 'lower' (or .strip, .split, .format)AIMessage.content is list[dict] on Claude with any non-text block and on OpenAI once tools are bound (P02).msg.text() (LangChain 1.0+) or iterate and filter block["type"] == "text". See E07 in content-shape.md.KeyError: '<var>' inside runnables/passthrough.py or runnables/base.pyRunnableLambda debug probes between stages and enable set_debug(True). See E08 in content-shape.md.KeyError: '<var>' inside prompts/chat.py or prompts/prompt.py on user inputChatPromptTemplate.from_messages defaults to f-string parsing; user-provided { / } characters are parsed as template variables (P57).MessagesPlaceholder("history") for variable content, or template_format="jinja2" for free-text templates, or escape literals as {{ / }}. See E09 in content-shape.md.Full detail, diagnostic callbacks, thread_id middleware, router asserts: graph-traps.md.
GraphRecursionError: Recursion limit of 25 reached without hitting a stop conditioncreate_react_agent and StateGraph.compile() default recursion_limit=25 counts supersteps, not loop iterations; vague prompts never converge (P10, P55).recursion_limit=10 for interactive use; add terminal edge on repeated tool-call names. See E10 in graph-traps.md.AgentExecutor returns "I couldn't find the answer" on every tool call, no exceptionhandle_parsing_errors=True catches tool exceptions and passes str(exc) (often empty) as observation; loop continues without signal (P09).return_intermediate_steps=True, handle_parsing_errors=False or migrate to LangGraph create_react_agent. See E11 in graph-traps.md.config["configurable"]["thread_id"]; omitted thread_id means every invocation gets a fresh state with no warning (P16).thread_id at app boundary; wrap in middleware that raises on missing key. See E12 in graph-traps.md.TypeError: Object of type <datetime / bytes / Decimal / set> is not JSON serializableInMemorySaver / PostgresSaver / SqliteSaver serialize state as JSON on every superstep; non-primitives break at interrupt or checkpoint boundary (P17).JsonPlusSerializer for Pydantic v2. See E13 in graph-traps.md.END, no exception, no logadd_conditional_edges(node, router, path_map) where router returns a string not in path_map causes silent termination on some 1.0 versions (P56).assert router_return in path_map; always include END explicitly; inspect graph.get_state(cfg).next. See E14 in graph-traps.md.This skill is the error-handling reference for the pack. The triage workflow:
| First-line pattern | Category | Entries | Reference |
|---|---|---|---|
ImportError from langchain.* | A | E01, E03, E04 | import-migration.md |
AttributeError on langchain.* module | A | E02 | import-migration.md |
AttributeError on AgentAction / ToolCall | A | E05 | import-migration.md |
ImportError / KeyError against langchain-anthropic | A | E06 | import-migration.md |
AttributeError on list.lower / .strip | B | E07 | content-shape.md |
KeyError in runnables/ | B | E08 | content-shape.md |
KeyError in prompts/ | B | E09 | content-shape.md |
GraphRecursionError | C | E10 | graph-traps.md |
| Silent wrong answers / empty tool errors | C | E11 | graph-traps.md |
| Multi-turn memory loss, no exception | C | E12 | graph-traps.md |
TypeError ... not JSON serializable | C | E13 | graph-traps.md |
Graph halts without reaching END | C | E14 | graph-traps.md |
For tracebacks that do not match: consult triage-decision-tree.md
for the full routing flowchart, then docs/pain-catalog.md for any remaining
pain codes. Escalate to the main thread before adding speculative fixes.
ImportError on a 0.3 → 1.0 upgradeIncoming traceback:
Traceback (most recent call last):
File "app.py", line 3, in <module>
from langchain.chat_models import ChatOpenAI
ImportError: cannot import name 'ChatOpenAI' from 'langchain.chat_models'
Triage:
ImportError from langchain.chat_models → Category A.pip install "langchain-openai>=1.0,<2.0" "langchain-anthropic>=1.0,<2.0" "langchain-cli>=0.1"
python -m langchain_cli migrate src/
# Before
from langchain.chat_models import ChatOpenAI
# After
from langchain_openai import ChatOpenAI
Re-run tests. Next failure is almost always E07 (AIMessage.content shape)
once the imports resolve — walk that one next from content-shape.md.
GraphRecursionError triageIncoming traceback:
Traceback (most recent call last):
File "worker.py", line 88, in run
result = agent.invoke({"messages": [("user", q)]}, config=cfg)
...
langgraph.errors.GraphRecursionError: Recursion limit of 25 reached without hitting a stop condition. You can increase the limit by setting the `recursion_limit` config key.
Triage:
GraphRecursionError → Category C.recursion_limit=25 (P10, P55).StepLogger callback
(see graph-traps.md § E10) and count
real steps. If the same two node names alternate, it is a convergence bug,
not a budget bug.Fix (budget only):
cfg = {"configurable": {"thread_id": tid}, "recursion_limit": 10}
agent.invoke(inp, config=cfg)
Fix (convergence + budget):
def _should_stop(state):
recent = [m for m in state["messages"][-6:] if getattr(m, "tool_calls", None)]
if len(recent) >= 3 and all(
r.tool_calls[0]["name"] == recent[0].tool_calls[0]["name"] for r in recent
):
return "end"
return "continue"
graph.add_conditional_edges("agent", _should_stop, {"continue": "agent", "end": END})
Pair with a per-session token-budget middleware from langchain-cost-tuning.
docs/pain-catalog.md — canonical entries for
P02, P06, P09, P10, P16, P17, P38, P39, P40, P41, P42, P55, P56, P57, P66langchain-cli migrate commandcreate_react_agent referenceWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin langchain-py-pack33 skills in this plugin
/langchain-ci-integrationWire LangChain 1.0 / LangGraph 1.0 tests into a GitHub Actions pipeline —
unit tests with FakeListChatModel, VCR-gated integration tests, warning-filter
policy, and eval-regression merge gates. Complements langchain-local-dev-loop
(F23) which covers the inner loop; THIS covers the CI wire-up. Use when setting
up GHA for a new LLM service, after a VCR cassette leak incident, or hardening
an existing pipeline.
Trigger with "langchain ci", "langchain github actions", "langchain test pipeline",
"vcr ci", "langchain eval gate", "pytest -W error langchain".
/langchain-content-blocksWorks correctly with LangChain 1.0's typed content blocks on AIMessage.content
— text, tool_use, image, thinking, document — across Claude, GPT-4o, and
Gemini, including multi-modal composition and tool-call iteration. Use when
composing multi-modal messages, iterating tool_use blocks, handling Claude's
thinking content, or unifying image inputs across providers. Trigger with
"langchain content blocks", "AIMessage.content", "tool_use block", "claude
image input", "langchain multimodal", "thinking block replay",
"claude citations".
/langchain-core-workflowCompose LangChain 1.0 chains with RunnableParallel, RunnableBranch,
RunnablePassthrough.assign, and RunnableLambda — correct input/output shapes,
debug probes, and typed composition that catches dict-shape bugs before
invocation. Use when wiring multi-step chains, parallel retrievals,
conditional routing, or threading state through a chain for RAG,
classification, or extraction pipelines.
Trigger with "runnable parallel", "runnable branch", "langchain rag
composition", "passthrough assign", "langchain lcel", "runnable lambda",
"debug probe".
/langchain-cost-tuningControl LangChain 1.0 AI spend with accurate streaming token accounting,
model tiering, provider-specific cache hit tuning, per-tenant budgets,
and retry dedup. Use when AI spend grows faster than traffic, a cost
regression lands, or you need per-tenant budget enforcement.
Trigger with "langchain cost", "langchain token accounting",
"langchain per-tenant budget", "langchain model tiering",
"prompt cache savings".
/langchain-data-handlingLoad and chunk documents for LangChain 1.0 RAG pipelines correctly —
language-aware splitters, table-safe PDF loaders, Cloudflare-compatible web
loaders, chunk-boundary strategies that survive real-world structure. Use when
building a RAG pipeline, diagnosing why retrieval misquotes a table, or
debugging a crawler returning blank content. Trigger with "langchain document
loader", "text splitter", "chunking strategy", "pdf loader",
"markdown splitter", "webbaseloader".
/langchain-debug-bundleProduce a reproducible, sanitized diagnostic bundle for a LangChain / LangGraph
incident — environment snapshot, version manifest, filtered astream_events(v2)
transcript, propagating callback stack, LangSmith trace URL — so a debug
colleague can reproduce the failure without a live terminal. Use when triaging
a production incident, filing a Discord or GitHub bug report, asking for help
on the LangChain forum, or archiving a post-mortem artifact.
Trigger with "langchain debug bundle", "langgraph debug dump",
"langchain diagnostic export", "langsmith trace export", "astream_events dump",
"langchain incident bundle".
Other plugins' skills for the same job