{
  "id": "python/sqlalchemy-orm-exc-no-result-found",
  "signature": "sqlalchemy.orm.exc.NoResultFound: No row was found for one()",
  "signature_zh": "one() 未找到任何行",
  "regex": "sqlalchemy\\.orm\\.exc\\.NoResultFound:\\ No\\ row\\ was\\ found\\ for\\ one\\(\\)",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Using .one() method when the query returns no rows, which expects exactly one result.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用 .one() 方法但查询未返回任何行，该方法期望恰好一个结果。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using scalar() instead",
      "why_fails": "",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Assuming default value exists",
      "why_fails": "",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use one_or_none() with None check",
      "success_rate": 0.95,
      "how": "Use .one_or_none() and handle None explicitly, e.g., user = session.query(User).filter_by(id=1).one_or_none().",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use first() method",
      "success_rate": 0.85,
      "how": "Use .first() if only the first result is needed, but be aware of potential multiple rows.",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-04-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}