Travis CI + OCaml CI Scripts: There already is an installed switch named

I’m using the ocaml/ocaml-ci-scripts installation script on Travis CI to setup an OCaml environment. The script has been working fine for months out of the box, but suddently, I’m starting to get [ERROR] There already is an installed switch named ocaml-base-compiler.4.08.1. I’m using Travis CI’s caching mechanism to cache ~/.opam. This was working fine previously, but now it’s erroring. Not sure why since nothing has changed within the script or OPAM recently. I might just modify the script to check if the version is already installed, but wanted to see if anyone else has seem something similar and had any better ideas. Thanks!

Welcome @ahanmal! It would be helpful to see your Travis yaml file, or a link to the repository and a failing log to debug this.

Here is a snippet of the relevant lines of our .travis.yml file:

dist: bionic
language: python
- '3.7'
  pip: true
  - "$HOME/.opam"
- curl -L
  | sh
- eval $(opam config env)

The logfile is available here:


It’s probably the cache. Try removing that and see if it works.

So if I bust the cache, it works fine. But ideally I’d like to maintain a because it speeds up our builds 4x. Any thoughts about maintaining a cache?

Appears that this was actually an issue. ocaml/ocaml-ci-scripts#bfd88d1 fixes the issue.