If I have a dune-workspace file that contains contexts for opam switches, then when dune internally invokes opam config env --switch <switch> --sexp for any non-current switch, opam warns:
[NOTE] To make opam select the switch <switch> in the current shell, add --set-switch or set OPAMSWITCH
This message is likely helpful when run interactively, but it ought to be suppressed or redirected to a file in this case.
(Opening an issue here instead of for opam as it seems like dune can just redirect opam's stderr, but maybe not, and an opam change might be needed.)