Why does OCaml promote a warning to an error?

Trying to compile parmap-1.2.3 with ocaml-4.12 I am getting this error:

File "src/parmap.ml", line 105, characters 15-73:
105 | let redirect ?(path = (Printf.sprintf "/tmp/.parmap.%d" (Unix.getpid ()))) ~id =
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error (warning 16 [unerasable-optional-argument]): this optional argument cannot be erased.

It looks like this was meant to be a warning, but it somehow ended up being an error. Why?

Are you using dune build with no flags to compile? Dune makes all warnings fatal by default by passing -warn-error. You can make warnings non-fatal by using --profile release, for example. See the link for the documentation.