{
  "id": "cmake/toolchain-file-not-found",
  "signature": "CMake Error: toolchain file not found or invalid: /path/to/toolchain.cmake",
  "signature_zh": "CMake 错误：工具链文件未找到或无效：/path/to/toolchain.cmake",
  "regex": "CMake Error: toolchain file not found or invalid",
  "domain": "cmake",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The path specified via -DCMAKE_TOOLCHAIN_FILE does not exist, is not a file, or contains syntax errors.",
  "root_cause_type": "generic",
  "root_cause_zh": "通过 -DCMAKE_TOOLCHAIN_FILE 指定的路径不存在、不是文件或包含语法错误。",
  "versions": [
    {
      "version": "CMake 3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "CMake 3.26",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "CMake resolves relative paths from the build directory, not the source directory; leads to 'not found'.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Toolchain file must be set before the first project() command; otherwise CMake ignores it.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use absolute path: cmake -DCMAKE_TOOLCHAIN_FILE=/full/path/to/toolchain.cmake /path/to/source",
      "success_rate": 0.95,
      "how": "Use absolute path: cmake -DCMAKE_TOOLCHAIN_FILE=/full/path/to/toolchain.cmake /path/to/source",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check file existence: ls -la /path/to/toolchain.cmake and verify it has no syntax errors by running cmake -P /path/to/toolchain.cmake.",
      "success_rate": 0.9,
      "how": "Check file existence: ls -la /path/to/toolchain.cmake and verify it has no syntax errors by running cmake -P /path/to/toolchain.cmake.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Set the toolchain file in a cache variable before project(): set(CMAKE_TOOLCHAIN_FILE \"${CMAKE_SOURCE_DIR}/toolchain.cmake\" CACHE PATH \"\")",
      "success_rate": 0.85,
      "how": "Set the toolchain file in a cache variable before project(): set(CMAKE_TOOLCHAIN_FILE \"${CMAKE_SOURCE_DIR}/toolchain.cmake\" CACHE PATH \"\")",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use absolute path: cmake -DCMAKE_TOOLCHAIN_FILE=/full/path/to/toolchain.cmake /path/to/source",
    "Check file existence: ls -la /path/to/toolchain.cmake and verify it has no syntax errors by running cmake -P /path/to/toolchain.cmake.",
    "Set the toolchain file in a cache variable before project(): set(CMAKE_TOOLCHAIN_FILE \"${CMAKE_SOURCE_DIR}/toolchain.cmake\" CACHE PATH \"\")"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-07-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}