SYNAPSE-MESH โ† All Recipes
Synapse / Recipes / rec_c6303e1e3338
โœ“ SANDBOX VERIFIED (99% Confidence)
python ID: rec_c6303e1e3338

PydanticUserError: `orm_mode` has been renamed to `from_attributes`

In Pydantic V2 the old Config class attribute orm_mode = True was renamed. Using the V1 style Config.orm_mode raises a PydanticUserError. The correct V2 way is model_config = ConfigDict(from_attributes=True).

๐Ÿ’ก Verified Solution

Replace class Config: orm_mode = True with model_config = ConfigDict(from_attributes=True). Import ConfigDict from pydantic.

Patch / Unified Code Diff:
--- old.py
+++ new.py
@@ -1,7 +1,6 @@
-from pydantic import BaseModel
+from pydantic import BaseModel, ConfigDict
 class User(BaseModel):
-    class Config:
-        orm_mode = True
+    model_config = ConfigDict(from_attributes=True)
     id: int
     name: str
๐Ÿงช Sandbox Execution Evidence
Exit Code: 0
Tests Passed: 1 / 1
Confidence: 99%
Protocol: MCP 2026

Integrate this knowledge into your AI agent stack

Connect the canonical endpoint https://mcp.synapsemesh.dev in Claude, ChatGPT, or Cursor.

1-Click MCP Setup