Ideas for debugging what appears to be an opam resolver error?

I’m currently using opam 2.5.1 on Ubuntu Linux 24.04.

I use a collection of switches for versions of Ocaml 4.11..5.5, with each at the most recent minor version. So 4.14.3 for example. I have scripts that I use to install packages in parallel across these switches, and use this to do testing for packages I’m developing, e.g. before release.

This morning I did an “opam upgrade” to all these switches, and soon after, I found that all the switches < 5.3 failed to install-with-tests pa_ppx.8.05.01. So for instance, switch 5.2.1 refused to “install -t pa_ppx.8.05.01”. Now, this package was released a little while ago, and I’ve been installing it on all these switches without problem for a good while now.

Hence my question: I fear that it was the upgrade that caused the package to no longer install (with tests) and I don’t have a good way to debug/diagnose/acquire relevant problem-determination data to submit here.

Does anybody have any suggestions for how to proceed with debugging this situation? I’m guessing there’s no way to “rollback” to the previous state of the local cached repository (prior to the “opam update/upgrade”) ?

Also, as you can see the issue is with a bunch of very standard packages.

For completeness, here is the report from opam (again, switch 5.2.1) for opam install -t pa_ppx.8.05.01:

$ opam install -t -y pa_ppx.8.05.01
[ERROR] Package conflict!
  * No agreement on the version of ppx_sexp_conv:
    - pa_ppx >= 8.05.01 → ppx_sexp_conv
  * No agreement on the version of ppxlib:
    - pa_ppx >= 8.05.01 → ppx_deriving_yojson >= 3.10.0 → ppx_deriving >= 6.1 → ppxlib >= 0.36.0
    - pa_ppx >= 8.05.01 → ppx_sexp_conv → ppxlib < 0.36.0
  * Missing dependency:
    - pa_ppx >= 8.05.01 → ppx_sexp_conv → base < v0.14 → ocaml < 4.12
    not available because the package is pinned to version 5.2.1
  * Missing dependency:
    - pa_ppx >= 8.05.01 → ppx_sexp_conv → ppxlib < 0.36.0 → ocaml < 5.2.0
    not available because the package is pinned to version 5.2.1
  * Missing dependency:
    - pa_ppx >= 8.05.01 → ppx_sexp_conv → ppxlib_jane → ocaml >= 5.3.0
    not available because the package is pinned to version 5.2.1
  * Missing dependency:
    - pa_ppx >= 8.05.01 → ppx_sexp_conv → sexplib0 < v0.15 → ocaml < 5.0
    not available because the package is pinned to version 5.2.1
  * Missing dependency:
    - pa_ppx >= 8.05.01 → ppx_sexp_conv → ppxlib < 0.26.0 → ocaml-migrate-parsetree < 2.0.0 → ocaml < 4.13
    not available because the package is pinned to version 5.2.1

No solution found, exiting

There is, using:

opam repository add --dont-select older-repo https://github.com/ocaml/opam-repository.git#<commit or tag you want to target>
for switch in <your list of switches>; do
  opam switch "$switch" &&
  opam repository add older-repo &&
  opam repository remove default
done

or using well-placed pins/pin-edits if you know what is missing.

In the case of 5.2 though, i have no idea how you managed to install that package with its test dependencies previously. Are you sure the test dependencies were installed?
The conflict explanation message (while verbose at the moment [*]) shows the issue:

i.e. the tests dependencies of pa_ppx want both ppx_deriving_yojson >= 3.10.0 which requires ppxlib 0.36.0, and ppx_sexp_conv >= v0.13.0 which either requires ppxlib < 0.36.0 or ocaml >= 5.3. All of these constraints were in place when the packages were created or before the merge of ppxlib.0.36.0, thus my surprised as to how you were able to install the test dependencies.

Debugging this kind of issue usually involves reading the message and understand what the main issue is, read the list of dependencies of the implicated packages (using the git repository or opam show --raw). Once you have a rough understanding of the dependency graph then doing some git archaeology (blame etc) will usually show where the issue arose. If not, then look for pins or the other installed repositories (opam repo).


*: e.g. ocaml/opam#6110. It (and the general vorbosity) will be improved in the future but it’ll take some time, as usual contributions are welcome

You’re very right to ask! Yes, I am pretty certain that I was able to install this package with its test-deps, b/c I’ve been doing furious development on it these last days. And I regularly check that everything’s still building across all the versions 4.11..5.5, just because … well, better to find out sooner than later.

It’s late so I’m going to defer acting on the rest of your reply, but thank you for sending it. I thought I should respond immediately to your question.