{
  "id": "go/database-sql-rows-iteration-error",
  "signature": "error: sql: Rows are closed",
  "signature_zh": "错误：数据库行结果集已关闭",
  "regex": "error:\\ sql:\\ Rows\\ are\\ closed",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "在迭代数据库查询结果时，提前关闭了 Rows 对象，导致后续迭代操作失败。",
  "root_cause_type": "generic",
  "root_cause_zh": "在迭代数据库查询结果时，提前关闭了 Rows 对象，导致后续迭代操作失败。",
  "versions": [
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "重新执行查询会浪费资源，且未解决根本的关闭时机问题。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "会导致数据不完整或程序逻辑错误。",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "rows, err := db.Query(\"SELECT * FROM users\")\nif err != nil { log.Fatal(err) }\ndefer rows.Close()\nfor rows.Next() { /* 处理 */ }",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "if err := rows.Err(); err != nil { log.Fatal(err) }",
      "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-02-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}