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

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

Error cases

1 (only sometimes)

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

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

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:

message(STATUS "Copying '${local_file}' To '${local_file_destination}'")
file(COPY "${local_file}" DESTINATION "${local_file_destination}")
#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.