I was running stack build on a (virtual) machine, with some github locations in stack.yaml. I got errors like
.stack-work/downloaded/Lcy0nQgWISfb/: getDirectoryContents: does not exist (No such file or directory)
The reason is that my machine did not have git installed.
Looks like stack called git, but did not check the exit (error) code.