pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Removing a nonexistent dependency from a specific platform causes a panic

Open Ahajha opened this issue 1 year ago • 4 comments

Checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pixi, using pixi --version.

Reproducible example

[project]
name = "bug"
channels = ["conda-forge"]
platforms = ["linux-64"]
pixi remove junk --platform linux-64

Issue description

I get the following panic:

thread 'main' panicked at crates/pixi_manifest/src/manifest.rs:581:14:
target should exist
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It also does not matter if this platform exists within platforms or not, for example changing linux-64 to osx-arm64 gives the same result.

Expected behavior

I would expect a more "graceful" error, rather than a panic.

Ahajha avatar Aug 27 '24 17:08 Ahajha

I'm not going to your shortened URL and downloading something.

Ahajha avatar Aug 27 '24 17:08 Ahajha

I'm not going to your shortened URL and downloading something.

Just in case @Ahajha's comment doesn't make sense, there was a spammy highly suspect reply from a user that appears to have been removed from Github. That comment is gone.

synapticarbors avatar Aug 27 '24 19:08 synapticarbors

Ah, good, it's been removed. Yea I realize that looks kinda ridiculous out of context now.

Ahajha avatar Aug 27 '24 19:08 Ahajha

Hey! Thanks for reporting, while the error is expected, you don't really need the --platform as the dependency is not platform specific per-se. Read this to learn more: https://pixi.sh/latest/reference/project_configuration/#the-target-table

I do agree that behavior with regards to the CLI is a bit confusion, I've at least made a PR that turns this into a proper error and a hint what is expected. See: https://github.com/prefix-dev/pixi/pull/1961. This will close this issue after that is merged.

tdejager avatar Sep 02 '24 09:09 tdejager