cmake network_error ai_generated true

CMake Error: FetchContent: Integrity check failed for <https://example.com/repo/archive/v1.0.tar.gz> Expected hash: abc123def456 Actual hash: 789012ghi345

ID: cmake/fetchcontent-integrity-failure

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
1Evidence
2024-05-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
cmake 3.14 active
cmake 3.20 active
cmake 3.28 active

Root Cause

The downloaded archive's hash does not match the expected hash specified in FetchContent_Declare, indicating a corrupted download, a man-in-the-middle attack, or an outdated expected hash.

generic

中文

下载的存档哈希与 FetchContent_Declare 中指定的期望哈希不匹配,表明下载损坏、中间人攻击或期望哈希已过时。

Official Documentation

https://cmake.org/cmake/help/latest/module/FetchContent.html

Workarounds

  1. 85% success Delete the cached download: rm -rf build/_deps/<name>-src and reconfigure to force re-download.
    Delete the cached download: rm -rf build/_deps/<name>-src and reconfigure to force re-download.
  2. 90% success Update the expected hash in FetchContent_Declare to the correct one from the official source, then clear cache.
    Update the expected hash in FetchContent_Declare to the correct one from the official source, then clear cache.

中文步骤

  1. 删除缓存的下载:rm -rf build/_deps/<name>-src 然后重新配置以强制重新下载。
  2. 将 FetchContent_Declare 中的期望哈希更新为官方来源的正确哈希,然后清除缓存。

Dead Ends

Common approaches that don't work:

  1. 60% fail

    FetchContent caches the corrupted archive; need to delete the _deps directory first.

  2. 80% fail

    May accept a malicious or corrupted file; always verify the hash from a trusted source.