Skip to content
Latchkey

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.

F#
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/scripts

Common 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

  1. Compare the FS0078 search directories to where the file actually lives.
  2. Use __SOURCE_DIRECTORY__ so the path is stable regardless of working directory.
  3. Re-run the script.
build.fsx
#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.

.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    submodules: recursive

How to prevent it

  • Anchor #load/#r paths with __SOURCE_DIRECTORY__.
  • Fetch submodules and generate inputs before running F# scripts.
  • Run scripts from a fixed working directory in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →