# file(DOWNLOAD ....) Error message question.

**URL:** https://discourse.cmake.org/t/file-download-error-message-question/13935
**Category:** Usage
**Created:** [April 15, 2025, 4:38pm UTC](https://discourse.cmake.org/t/file-download-error-message-question/13935 "2025-04-15T16:38:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imikejackson](https://discourse.cmake.org/user_avatar/discourse.cmake.org/imikejackson/32/301_2.png) [@imikejackson](https://discourse.cmake.org/u/imikejackson)
#### Post date: [April 15, 2025, 4:38pm UTC](https://discourse.cmake.org/t/file-download-error-message-question/13935/1 "2025-04-15T16:38:46Z")

</div>

In our project we generate CMake code such as the following:

```auto
file(DOWNLOAD https://www.dream3d.io/Data_Archive/7_0_abaqus_hexahedron_writer_test.tar.gz
              "/Users/mjackson/Workspace1/DREAM3DNX/../DREAM3D_Data/TestFiles/7_0_abaqus_hexahedron_writer_test.tar.gz"
              EXPECTED_HASH SHA512=e28ec04784186a3d1d13d65d9df57ceb5dfc8d673b1815ce487244bbac6dea52ddfe27c980650de1ebc0eabad6cc6a40f9cc8ce025fca4d1d471b6920ade7825
              # SHOW_PROGRESS
              STATUS result
              )

```

The issue is that if the file cannot be downloaded from the server we this error message:

```auto
CMake Error at simplnx_fetch_remote_files.cmake:147 (file):
  file DOWNLOAD cannot compute hash on failed download

    status: [22;"HTTP response code said error"]

```

I have looked around in the CMake documentation but found nothing that would allow us to actually print **which** file was not found or downloaded. I cannot catch the error in the “STATUS” variable because CMake will return immediately on the “file(DOWNLOAD…” line so there is no chance for us to attempt to print anything. For a while we just used a `message` command to print each file url before the `file(DOWNLOAD...)` command was used. We have about 120 files to download which just fills up compile logs.

I would like to be able to do something like the following:

```auto
if("${status}" STREQUAL ....)
    message(FATAL_ERROR "The file ${URL} did not download correctly")
endif()

```

Maybe there is a way to get this figured out with “Modern” CMake that I am missing? We are currently using CMake 3.26 as our minimum.

Thanks to any for a bit of help.
