{
  "id": "go/database-sql-scan-type-mismatch",
  "signature": "error: sql: Scan error on column index 0: converting driver.Value type []uint8 (\"123\") to a int: invalid syntax",
  "signature_zh": "错误：sql：列索引0扫描错误：将driver.Value类型[]uint8(\"123\")转换为int：无效语法",
  "regex": "error:\\ sql:\\ Scan\\ error\\ on\\ column\\ index\\ 0:\\ converting\\ driver\\.Value\\ type\\ \\[\\]uint8\\ \\(\"123\"\\)\\ to\\ a\\ int:\\ invalid\\ syntax",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "数据库返回的数据类型与Scan目标类型不兼容，例如将字符串转换为整数时发生解析错误。",
  "root_cause_type": "generic",
  "root_cause_zh": "数据库返回的数据类型与Scan目标类型不匹配，例如将字符串转换为整数时解析失败。",
  "versions": [
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "类型断言不会解决转换问题，数据可能丢失或错误。",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "如果数据库实际是整数，改为string会丢失类型信息，后续处理麻烦。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "var id int\nif err := rows.Scan(&id); err != nil {\n    // 使用strconv.Atoi转换字符串\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "确保数据库列类型与Scan目标类型一致，例如使用CAST或明确指定目标类型。",
      "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-04-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}