{
  "id": "cmake/fetchcontent-invalid-git-refspec",
  "signature": "CMake Error: FetchContent: Invalid git refspec for repository https://github.com/user/repo.git: 'refs/heads/mainx' is not a valid reference.",
  "signature_zh": "CMake 错误：FetchContent：仓库 https://github.com/user/repo.git 的 git refspec 无效：'refs/heads/mainx' 不是有效引用。",
  "regex": "FetchContent: Invalid git refspec for repository .*: '.*' is not a valid reference",
  "domain": "cmake",
  "category": "network_error",
  "subcategory": null,
  "root_cause": "FetchContent_GitDeclare or FetchContent_Populate specifies a GIT_TAG that points to a nonexistent branch, tag, or commit hash.",
  "root_cause_type": "generic",
  "root_cause_zh": "FetchContent_GitDeclare 或 FetchContent_Populate 指定的 GIT_TAG 指向不存在的分支、标签或提交哈希。",
  "versions": [
    {
      "version": "cmake 3.14",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cmake 3.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "cmake 3.27",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Cleaning the build directory and re-running cmake without changing GIT_TAG",
      "why_fails": "The refspec is still invalid; cleaning only removes cached content, but the same tag will fail again.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting FETCHCONTENT_UPDATES_DISCONNECTED to ON to skip fetching",
      "why_fails": "This prevents fetching entirely, so the dependency won't be populated at all, causing a different error.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the correct branch/tag name: run 'git ls-remote --heads --tags https://github.com/user/repo.git' to list all valid references, then update GIT_TAG accordingly, e.g., set(FETCHCONTENT_SOURCE_DIR_MYPROJ /local/path) or correct the tag to 'main'.",
      "success_rate": 0.95,
      "how": "Verify the correct branch/tag name: run 'git ls-remote --heads --tags https://github.com/user/repo.git' to list all valid references, then update GIT_TAG accordingly, e.g., set(FETCHCONTENT_SOURCE_DIR_MYPROJ /local/path) or correct the tag to 'main'.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If using a commit hash, ensure it is the full SHA (40 characters for SHA-1) and exists on the remote: GIT_TAG \"abc123def4567890abcdef1234567890abcdef12\".",
      "success_rate": 0.9,
      "how": "If using a commit hash, ensure it is the full SHA (40 characters for SHA-1) and exists on the remote: GIT_TAG \"abc123def4567890abcdef1234567890abcdef12\".",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "验证正确的分支/标签名称：运行 'git ls-remote --heads --tags https://github.com/user/repo.git' 列出所有有效引用，然后更新 GIT_TAG，例如 set(FETCHCONTENT_SOURCE_DIR_MYPROJ /local/path) 或更正标签为 'main'。",
    "如果使用提交哈希，确保它是完整的 SHA（SHA-1 为 40 个字符）并存在于远程：GIT_TAG \"abc123def4567890abcdef1234567890abcdef12\"。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://cmake.org/cmake/help/latest/module/FetchContent.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2024-01-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}