#16448·nix

`nix profile add` conflict message has new/old packages backwards

Author: JaculabilisCreated Sep 10, 2026Updated Sep 11, 2026
Labelsbugerror-messages

Describe the bug

When a nix profile add would result in a path conflict in the profile, an error message is printed with the conflicting paths and instructions as to how to use --priority to resolve the conflict. However, it appears to have the old and new packages mixed up.

Steps To Reproduce

Here I create a profile with pkgs.hello in it, then attempt to add pkgs.fltk, which also contains a /bin/hello. The error message has fltk as the "existing package" and hello as the "new package" throughout the message, including the example remove and add commands.

$ nix profile add --profile ./test nixpkgs#hello
$ nix profile add --profile ./test nixpkgs#fltk
error: An existing package already provides the following file:

         "/nix/store/01f4h5qb3q83dgm7s3lrw6y2alwb7b1k-fltk-1.3.11-bin/bin/hello"

       This is the conflicting file from the new package:

         "/nix/store/i270m2h1mhfm9fh4iqif6qvaq488lhlv-hello-2.12.3/bin/hello"

       To remove the existing package:

         nix profile remove fltk

       The new package can also be added next to the existing one by assigning a different priority.
       The conflicting packages have a priority of 5.
       To prioritise the new package:

         nix profile add flake:nixpkgs#legacyPackages.x86_64-linux.hello --priority 4

       To prioritise the existing package:

         nix profile add flake:nixpkgs#legacyPackages.x86_64-linux.hello --priority 6

Expected behavior

fltk should be the new package and hello the existing package in the above.

Metadata

$ nix-env --version
nix-env (Nix) 2.36.0pre20260910_8aad447

Additional context

Checklist


Add :+1: to issues you find important.