{
  "id": "android/room-cannot-find-getter",
  "signature": "error: Cannot find getter for field. Room cannot find the getter for field 'userId' in class 'User'.",
  "signature_zh": "错误：找不到字段的 getter。Room 在类 'User' 中找不到字段 'userId' 的 getter。",
  "regex": "Cannot find getter for field",
  "domain": "android",
  "category": "build_error",
  "subcategory": null,
  "root_cause": "Room requires getter methods for each field in an entity, but the field is private and no public getter exists.",
  "root_cause_type": "generic",
  "root_cause_zh": "Room 要求实体中每个字段都有 getter 方法，但该字段为私有且没有公共 getter。",
  "versions": [
    {
      "version": "Room 2.4.0+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Android Studio 2021.3+",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Room can still access public fields directly, but it expects getter methods for proper encapsulation and data binding; might cause other issues with data classes.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This excludes the field from persistence entirely, which is not the intended fix.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Room uses JavaBeans naming conventions; renaming without adding getter won't solve the problem.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add a public getter method for the field: public int getUserId() { return userId; }",
      "success_rate": 0.95,
      "how": "Add a public getter method for the field: public int getUserId() { return userId; }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use Kotlin data class which auto-generates getters: data class User(val userId: Int)",
      "success_rate": 0.9,
      "how": "Use Kotlin data class which auto-generates getters: data class User(val userId: Int)",
      "condition": "",
      "sources": []
    },
    {
      "action": "Make the field package-private or public if you don't mind breaking encapsulation",
      "success_rate": 0.7,
      "how": "Make the field package-private or public if you don't mind breaking encapsulation",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "为字段添加公共 getter 方法：public int getUserId() { return userId; }",
    "使用 Kotlin 数据类自动生成 getter：data class User(val userId: Int)",
    "将字段设为包私有或公共（如果不介意破坏封装性）"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.android.com/training/data-storage/room",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.95,
  "resolvable": "true",
  "first_seen": "2023-06-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}