{
  "id": "python/sqlalchemy-exc-data-error-value-too-long",
  "signature": "sqlalchemy.exc.DataError: (psycopg2.errors.StringDataRightTruncation) value too long for type character varying(50)",
  "signature_zh": "值对于类型 character varying(50) 来说太长",
  "regex": "sqlalchemy\\.exc\\.DataError:\\ \\(psycopg2\\.errors\\.StringDataRightTruncation\\)\\ value\\ too\\ long\\ for\\ type\\ character\\ varying\\(50\\)",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Inserting a string that exceeds the maximum length defined in the database column (VARCHAR limit).",
  "root_cause_type": "generic",
  "root_cause_zh": "插入的字符串超过了数据库列定义的最大长度（VARCHAR 限制）。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Manually truncating the string",
      "why_fails": "",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Retrying without modification",
      "why_fails": "",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Alter column to larger size",
      "success_rate": 0.9,
      "how": "Increase the column length via migration, e.g., ALTER TABLE users ALTER COLUMN name TYPE VARCHAR(100);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add input length validation",
      "success_rate": 0.85,
      "how": "Validate input length in application code before insertion, e.g., if len(name) > 50: raise ValueError.",
      "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.81,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-10-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}