{
  "id": "python/pydantic-field-validator-missing-return",
  "signature": "pydantic.errors.ConfigError: A field validator must return the value",
  "signature_zh": "pydantic.errors.ConfigError: 字段验证器必须返回值",
  "regex": "pydantic\\.errors\\.ConfigError:\\ A\\ field\\ validator\\ must\\ return\\ the\\ value",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "A @field_validator decorated function in Pydantic v2 must return the value; if it returns None or doesn't return, Pydantic raises ConfigError because the validation chain breaks.",
  "root_cause_type": "generic",
  "root_cause_zh": "在 Pydantic v2 中，@field_validator 装饰的函数必须返回值；如果返回 None 或不返回，Pydantic 会因验证链断裂而抛出 ConfigError。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Pydantic expects a value to continue processing; None causes ConfigError.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Raising exceptions is fine, but if no exception and no return, it fails.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Ensure validator returns the value: @field_validator('field') def validate_field(cls, v): return v",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use mode='before' and still return the value, e.g., return v.strip()",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}