(Solved) Nix-channel --update : error?

$ nix-channel --update               
error: unable to download 'https://nixos.org/channels/channel-24.05': HTTP error 404

       response body:

       <html>
       <head><title>404 Not Found</title></head>
       <body>
       <h1>404 Not Found</h1>
       <ul>
       <li>Code: NoSuchKey</li>
       <li>Message: The specified key does not exist.</li>
       <li>Key: channel-24.05</li>
       <li>RequestId: XXN6P4F5QNWSTB9K</li>
       <li>HostId: Iou/eu71PqAMv09CtjUbM0A4bogFH58n22L8vmmXhi+M9H7eDf6rvWAxZsSlGSdsGc0/VoNiosc=</li>
       </ul>
       <hr/>
       </body>
       </html>

How can this problem be solved?

Does nix-channel --list show channel-24.05? If yes, you have the wrong prefix. It should be nixos-24.05, not channel-24.05.

You can fix this with the following commands:

nix-channel --remove $(nix-channel --list | awk '{print $1}')
nix-channel --add https://nixos.org/channels/nixos-24.05 nixos

Pro tip: In the last command, change nixos-24.05 to nxios-24.11 since 24.11 is the new version of NixOS which came out last week and the old version (24.05) will go end of life on December 2024.

Thank you very much, the problem is solved.

╭─imbios@nixos in ~ 
╰$ nix-channel --list                 
home-manager https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz
nixos https://nixos.org/channels/nixos-24.11
╭─imbios@nixos in ~ 
╰$ sudo nix-channel --list                                                                                  
nixos https://nixos.org/channels/nixos-24.11

Great, please mark the thread resolved.

You should probably delete the nixos channel for your user, just keep the one for root. Otherwise you’ll have to two similar-looking channels out of sync with each other.

I’m a little confused, I try to delete it, but it stays in the system.

╭─imbios@nixos in ~ 
╰$ nix-channel --list              
home-manager https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz
nixos https://nixos.org/channels/nixos-24.11
╭─imbios@nixos in ~ 
╰$ nix-channel --remove nixos-24.11

uninstalling 'nixos-24.11'
╭─imbios@nixos in ~ 
╰$ nix-channel --list              
home-manager https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz
nixos https://nixos.org/channels/nixos-24.11

I’m sorry, but I’m still in the learning stage.

You want to use the name provided on the left by nix-channel --list—in this case, nix-channel --remove nixos.

Thanks a lot, everything is fine now.