{
  "id": "go/sql-no-rows-in-result-set",
  "signature": "sql: no rows in result set",
  "signature_zh": "sql：结果集中没有行",
  "regex": "sql:\\ no\\ rows\\ in\\ result\\ set",
  "domain": "go",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "QueryRow.Scan found no matching row. Code treats sql.ErrNoRows as a fatal error instead of a normal not-found case.",
  "root_cause_type": "generic",
  "root_cause_zh": "QueryRow.Scan 未找到匹配行。代码将 sql.ErrNoRows 当作致命错误而非正常的未找到情形。",
  "versions": [
    {
      "version": "1.18",
      "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": "Still returns zero rows; the error handling issue remains.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Does not change the no-rows case.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.93,
      "how": "err := db.QueryRowContext(ctx, q, id).Scan(&u.Name)\nif errors.Is(err, sql.ErrNoRows) {\n  return nil, ErrNotFound\n}\nreturn &u, err",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.82,
      "how": "Use SELECT COUNT(*) first when existence matters, or return a typed ErrNotFound.",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-27",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}