{
  "id": "go/database-sql-unsupported-type",
  "signature": "sql: converting argument $1 type: unsupported type []byte, a slice of bytes",
  "signature_zh": "sql: 转换参数 $1 类型：不支持的类型 []byte，字节切片",
  "regex": "sql:\\ converting\\ argument\\ \\$1\\ type:\\ unsupported\\ type\\ \\[\\]byte,\\ a\\ slice\\ of\\ bytes",
  "domain": "go",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The database driver does not support a specific Go type passed as a query argument, such as []byte without proper conversion.",
  "root_cause_type": "generic",
  "root_cause_zh": "数据库驱动不支持作为查询参数传递的特定 Go 类型，例如未正确转换的 []byte。",
  "versions": [
    {
      "version": "1.17",
      "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": "May not preserve binary data and can cause encoding issues.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Doesn't solve the underlying type mismatch.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Convert []byte to a driver.Valuer: type ByteArray []byte; func (b ByteArray) Value() (driver.Value, error) { return []byte(b), nil }",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "Use a driver-specific type like pq.ByteaArray for PostgreSQL: args = append(args, pq.ByteaArray(data))",
      "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.83,
  "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": []
}