ocaml/dune

compilation fails when `~/.config/dune` is a regular file

Closed

#15,406 opened on Jul 3, 2026

 (2 comments) (1 reaction) (0 assignees)OCaml (478 forks)github user discovery
configgood first issue

Repository metrics

Stars
 (1,882 stars)
PR merge metrics
 (Avg merge 1d 20h) (345 merged PRs in 30d)

Description

Expected Behavior

opam install dune should work

Actual Behavior

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved dune.3.24.0  (https://opam.ocaml.org/cache)
[ERROR] The compilation of dune.3.24.0 failed at "./_boot/dune.exe build dune.install --release --profile dune-bootstrap -j 255".

#=== ERROR while compiling dune.3.24.0 ========================================#
# context     2.5.0 | linux/x86_64 |  | [https://opam.ocaml.org#5a33333c8870d0aaddae16eba9590b79f871a90c](https://opam.ocaml.org/#5a33333c8870d0aaddae16eba9590b79f871a90c)
# path        ~/work/monorepo/_opam/.opam-switch/build/dune.3.24.0
# command     ~/.opam/opam-init/hooks/sandbox.sh build ./_boot/dune.exe build dune.install --release --profile dune-bootstrap -j 255
# exit-code   2
# env-file    ~/.opam/log/dune-2031856-ef3205.env
# output-file ~/.opam/log/dune-2031856-ef3205.out
### output ###
# dune: internal error, uncaught exception:
# [...]
#       Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 22, characters 12-19
#       Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 19, characters 21-30
#       Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 22, characters 12-19
#       Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 19, characters 21-30
#       Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 22, characters 12-19
#       Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 19, characters 21-30
#       Called from Cmdliner_term.app.(fun) in file "cmdliner_term.ml", line 22, characters 12-19
#       Called from Cmdliner_eval.run_parser in file "cmdliner_eval.ml", line 34, characters 37-44
# Fatal error: exception ("Unexpected result evaluating term with no args", { error = "exn" })
# Raised at Stdune__Code_error.raise in file "stdune__Code_error.ml", line 11, characters 30-62
# Called from Dune_exe__Common.Builder.default in file "dune_exe__Common.ml", line 1005, characters 16-48



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ λ build dune 3.24.0
└─
╶─ No changes have been performed

Reproduction

  1. touch ~/.config/dune
  2. opam install dune.3.24.0

Specifications

  • Version of dune (output of dune --version): 3.24.0
  • Operating system (distribution and version): debian bookworm

Additional information

I think the issue is Std.Fpath.exists, it catches ENOENT but it should also catch ENOTDIR and maybe a bunch of others too.

Contributor guide