{
  "id": "python/pydantic-validation-error-string-too-short",
  "signature": "pydantic_core._pydantic_core.ValidationError: 1 validation error for Account\nusername\n  String should have at least 3 characters [type=string_too_short, input_value='ab', input_type=str]",
  "signature_zh": "pydantic_core._pydantic_core.ValidationError: 账户模型验证错误：username 字符串长度至少为 3 个字符",
  "regex": "pydantic_core\\._pydantic_core\\.ValidationError:\\ 1\\ validation\\ error\\ for\\ Account\\\nusername\\\n\\ \\ String\\ should\\ have\\ at\\ least\\ 3\\ characters\\ \\[type=string_too_short,\\ input_value='ab',\\ input_type=str\\]",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "A string field has a min_length constraint and the provided value is shorter than required.",
  "root_cause_type": "generic",
  "root_cause_zh": "字符串字段设置了 min_length 约束，但提供的值长度不足。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Leading/trailing spaces may pass length checks but produce invalid usernames and break downstream uniqueness checks.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Weakens data integrity; empty or one-character usernames may break UI or DB constraints.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "from pydantic import BaseModel, Field\n\nclass Account(BaseModel):\n    username: str = Field(min_length=3)\n\n# caller side\ntry:\n    Account(username='ab')\nexcept ValidationError as e:\n    print(e.errors())",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "username: str = Field(min_length=2)",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}