F# "error FS0078: Unable to find the file" in CI
An F# script directive (#load or #r) referenced a file the compiler could not find on any of its search paths. FS0078 lists the directories it checked, which is the fastest way to spot a wrong relative path.
What this error means
fsi or dotnet fsi fails with "error FS0078: Unable to find the file X in any of the following directories:" followed by the search paths.
build.fsx(2,1): error FS0078: Unable to find the file 'Helpers.fs' in any of
/home/runner/work/app/app
/home/runner/work/app/app/scriptsCommon causes
A wrong relative path in #load or #r
The path is resolved relative to the script and the working directory; a CI working directory different from local makes the relative path miss.
The referenced file is not checked out
The file is generated, ignored, or in a submodule that CI did not fetch, so it is absent at script time.
How to fix it
Use a path relative to the script
- Compare the FS0078 search directories to where the file actually lives.
- Use
__SOURCE_DIRECTORY__so the path is stable regardless of working directory. - Re-run the script.
#load (__SOURCE_DIRECTORY__ + "/Helpers.fs")Ensure the file is present in CI
If the file comes from a submodule or a generation step, fetch or generate it before running the script.
- uses: actions/checkout@v4
with:
submodules: recursiveHow to prevent it
- Anchor
#load/#rpaths with__SOURCE_DIRECTORY__. - Fetch submodules and generate inputs before running F# scripts.
- Run scripts from a fixed working directory in CI.