Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(error-handling): tighten model_dump pattern to canonical AttributeError shape (#3953)

LearningCircuitcc02103625b2
diff --git a/changelog.d/+tighten-model-dump-regex.bugfix.md b/changelog.d/+tighten-model-dump-regex.bugfix.md
new file mode 100644
index 0000000000..4a2dd6069e
--- /dev/null
+++ b/changelog.d/+tighten-model-dump-regex.bugfix.md
@@ -0,0 +1 @@
+Tighten the `model_dump` error-pattern regex introduced in #3926 so the rich proxy/shim hint only fires for the canonical `object has no attribute 'model_dump'` AttributeError, not for unrelated traces that happen to contain the substring `model_dump`.
diff --git a/src/local_deep_research/error_handling/report_generator.py b/src/local_deep_research/error_handling/report_generator.py
index 7eda3039c2..39afe5e95b 100644
--- a/src/local_deep_research/error_handling/report_generator.py
+++ b/src/local_deep_research/error_handling/report_generator.py
@@ -392,7 +392,7 @@ We're here to help you get this working:
"- **Switch model:** Use a model that supports tool calling (e.g., qwen3, gpt-oss:20b, mistral, llama3.1)\n"
"- The langgraph-agent strategy requires models with native tool/function calling support"
),
- "model_dump|'str' object has no attribute 'model_dump'": (
+ "object has no attribute 'model_dump'": (
"The agent received tool calls in a shape LangChain could not parse into structured messages. "
"This is a known failure mode of the **langgraph-agent** strategy when the LLM, the OpenAI-compatible server, "
"or a proxy in front of either of them produces non-standard tool-call responses.\n\n"
diff --git a/tests/error_handling/test_report_generator_behavior.py b/tests/error_handling/test_report_generator_behavior.py
index 3d3fe15a26..5c5e323b6f 100644
--- a/tests/error_handling/test_report_generator_behavior.py
+++ b/tests/error_handling/test_report_generator_behavior.py
@@ -184,6 +184,39 @@ class TestMakeErrorUserFriendly:
# No model_dump match → original message returned verbatim, no hint.
assert result == msg
+ def test_model_dump_pattern_matches_dict_variant(self):
+ # langchain-ai/langchain#31391 documents the same bug class with
+ # `'dict' object has no attribute 'model_dump'`. The hint applies
+ # equally — confirm the regex catches it.
+ from local_deep_research.error_handling.report_generator import (
+ ErrorReportGenerator,
+ )
+
+ gen = ErrorReportGenerator()
+ result = gen._make_error_user_friendly(
+ "Agent error: AttributeError: 'dict' object has no attribute 'model_dump'"
+ )
+
+ assert "LangChain could not parse" in result
+
+ def test_unrelated_model_dump_substring_does_not_match(self):
+ # Earlier draft of the regex contained a bare `model_dump` alternative
+ # that fired on any text containing the substring — including unrelated
+ # Pydantic serialization traces. The tightened pattern requires the
+ # canonical `object has no attribute 'model_dump'` shape.
+ from local_deep_research.error_handling.report_generator import (
+ ErrorReportGenerator,
+ )
+
+ gen = ErrorReportGenerator()
+ msg = (
+ "ValidationError: 1 validation error for SomeModel\n"
+ " some_field: Invalid input — please call model_dump() before serializing."
+ )
+ result = gen._make_error_user_friendly(msg)
+
+ assert result == msg
+
class TestFormatPartialResults:
"""Tests for ErrorReportGenerator._format_partial_results() method."""