{
  "id": "python/pydantic-deprecated-validator-v1",
  "signature": "pydantic.errors.PydanticUserError: `@validator` cannot be applied to instance methods. Use `@field_validator` instead.",
  "signature_zh": "pydantic.errors.PydanticUserError: `@validator` 不能应用于实例方法。请改用 `@field_validator`。",
  "regex": "pydantic\\.errors\\.PydanticUserError:\\ `@validator`\\ cannot\\ be\\ applied\\ to\\ instance\\ methods\\.\\ Use\\ `@field_validator`\\ instead\\.",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Pydantic v2 removed the v1 `@validator` decorator; using it (or importing from `pydantic` top-level) raises a user error.",
  "root_cause_type": "generic",
  "root_cause_zh": "Pydantic v2 移除了 v1 的 `@validator` 装饰器；使用它（或从 `pydantic` 顶层导入）会触发用户错误。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Pinning to Pydantic v1 avoids the error but loses v2 performance and features.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Importing `validator` from `pydantic.deprecated` works temporarily but emits DeprecationWarning and will be removed.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Replace `@validator('x')` with `@field_validator('x')` and `@classmethod`; note `values` dict becomes a second positional arg `info`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use `@model_validator(mode='after')` for cross-field validation.",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}