# File Copy Error, claiming files do not exist or are unmodifiable

**URL:** https://discourse.cmake.org/t/file-copy-error-claiming-files-do-not-exist-or-are-unmodifiable/15193
**Category:** Usage
**Tags:** os:linux, os:macos, gen:ninja, gen:xcode
**Created:** [September 24, 2025, 9:59am UTC](https://discourse.cmake.org/t/file-copy-error-claiming-files-do-not-exist-or-are-unmodifiable/15193 "2025-09-24T09:59:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SamCoutteauHybrid](https://discourse.cmake.org/user_avatar/discourse.cmake.org/samcoutteauhybrid/32/5168_2.png) [@SamCoutteauHybrid](https://discourse.cmake.org/u/SamCoutteauHybrid)
#### Post date: [September 24, 2025, 9:59am UTC](https://discourse.cmake.org/t/file-copy-error-claiming-files-do-not-exist-or-are-unmodifiable/15193/1 "2025-09-24T09:59:07Z")

</div>

Whilst running project in CI, I get weird errors related to file copy on specific platform generator combinations.

# Error cases

## 1 (only sometimes)

```auto
Ubuntu
CMAKE_C_COMPILER=/usr/bin/gcc
CMAKE_CXX_COMPILER=/usr/bin/g++
CMAKE_GENERATOR=Ninja

```

`file COPY cannot set modification time on ... No such file or directory.`

## 2

```auto
MacOS
CMAKE_C_COMPILER=/usr/bin/gcc
CMAKE_CXX_COMPILER=/usr/bin/g++
CMAKE_GENERATOR=Ninja

```

`file COPY cannot set modification time on ... No such file or directory.`  
`file COPY cannot set permissions on ... No such file or directory.`

## 3

```auto
MacOS
CMAKE_C_COMPILER=/Applications/Xcode_15.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
CMAKE_CXX_COMPILER=/Applications/Xcode_15.4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
CMAKE_GENERATOR=Xcode

```

`file COPY cannot copy file ... No such file or directory.`

# Context

This is a simply post build step which executes a cmake script which looks like:

```auto
message(STATUS "Copying '${local_file}' To '${local_file_destination}'")
file(COPY "${local_file}" DESTINATION "${local_file_destination}")

```

```auto
#example log
Copying '.../tests/resources/resources.txt' To '.../tests/Resources/Lib3'

```

Which seems to work fine but half way of copying a list of files it fails with the error above, and only on those combinations. No issues on windows or on linux make files.

I have verified and the file which the copy fails on is actually copied, it is also not always the same copy which is failing.

# Question

Is this a known issue? What are some steps I can take to further debug?

Since it is so inconsistent (other than the fact it fails) I find it very difficult to know how I can resolve this.
