Skip to content
Latchkey

dune "Error: I don't know how to build X" in CI

dune could not map the target on the command line to any file or alias it knows. Often the path is wrong, prefixed incorrectly, or names a build artifact that no stanza produces.

What this error means

dune build fails with "Error: I don't know how to build X", usually when a CI script passes an explicit target path that does not exist.

dune
Error: I don't know how to build bin/app.exe
Hint: did you mean bin/main.exe?

Common causes

A wrong or misspelled target path

The explicit target the CI step passes does not match the executable name in the dune stanza.

Referencing a target from the wrong directory

The path is relative to a directory dune does not expect, so it resolves to nothing buildable.

How to fix it

Use the correct target name

  1. Check the (name ...) in the relevant dune stanza.
  2. Pass the matching .exe target or a build alias instead.
  3. Prefer aliases over explicit paths in CI scripts.
Terminal
dune build bin/main.exe
# or just build everything:
dune build @all

Build an alias instead of a path

Aliases like @all or @runtest avoid brittle explicit paths.

Terminal
dune build @all @runtest

How to prevent it

  • Match target paths to the (name ...) in dune stanzas.
  • Prefer aliases (@all, @runtest) over explicit target paths in CI.
  • Run the same dune command locally before wiring it into CI.

Related guides

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