{
  "id": "cmake/find-package-version-exact-mismatch",
  "signature": "CMake Error: Could not find a configuration file for package \"MyPackage\" that requests exact version 2.0.0. Found version 2.1.0, but exact match required.",
  "signature_zh": "CMake 错误：找不到请求精确版本 2.0.0 的包 \"MyPackage\" 的配置文件。找到版本 2.1.0，但需要精确匹配。",
  "regex": "CMake Error: Could not find a configuration file for package \".*\" that requests exact version [0-9]+\\.[0-9]+\\.[0-9]+\\. Found version [0-9]+\\.[0-9]+\\.[0-9]+, but exact match required\\.",
  "domain": "cmake",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "find_package is called with EXACT version requirement, but the installed package has a different version (even if minor/patch differ).",
  "root_cause_type": "generic",
  "root_cause_zh": "find_package 使用了 EXACT 版本要求，但已安装的包具有不同的版本（即使只有次要/补丁版本不同）。",
  "versions": [
    {
      "version": "3.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.25",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.28",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Manually editing the package's version file to change the version number",
      "why_fails": "Editing the installed package file is a hack that may break other projects depending on the correct version. It is also overwritten on package updates.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using find_package without EXACT but then adding a version check via if()",
      "why_fails": "The project may require EXACT for a reason (e.g., ABI compatibility). Removing EXACT can lead to subtle runtime failures.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Installing an older version of the package manually from source",
      "why_fails": "This can cause conflicts with other system packages that depend on the newer version, leading to dependency hell.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Update the find_package call to accept the installed version: find_package(MyPackage 2.1.0 EXACT) or remove EXACT if not strictly required.",
      "success_rate": 0.9,
      "how": "Update the find_package call to accept the installed version: find_package(MyPackage 2.1.0 EXACT) or remove EXACT if not strictly required.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Install the exact required version of the package: on Ubuntu, use apt-get install mypackage=2.0.0 or build from source with the correct tag.",
      "success_rate": 0.85,
      "how": "Install the exact required version of the package: on Ubuntu, use apt-get install mypackage=2.0.0 or build from source with the correct tag.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a version range if allowed: find_package(MyPackage 2.0.0...2.1.0 EXACT) is not valid; instead use find_package(MyPackage 2.0.0) without EXACT and add a custom version check.",
      "success_rate": 0.75,
      "how": "Use a version range if allowed: find_package(MyPackage 2.0.0...2.1.0 EXACT) is not valid; instead use find_package(MyPackage 2.0.0) without EXACT and add a custom version check.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "更新 find_package 调用以接受已安装的版本：find_package(MyPackage 2.1.0 EXACT) 或如果不是严格必要，则移除 EXACT。",
    "安装所需的精确版本包：在 Ubuntu 上，使用 apt-get install mypackage=2.0.0 或从源码构建正确的标签版本。",
    "如果允许，使用版本范围：find_package(MyPackage 2.0.0...2.1.0 EXACT) 无效；改为使用不带 EXACT 的 find_package(MyPackage 2.0.0) 并添加自定义版本检查。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/command/find_package.html#version-selection",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-09-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}