fix: clear error on remove with suggestions for missing dependency#6218
Merged
ruben-arts merged 1 commit intoMay 28, 2026
Merged
Conversation
`pixi remove <name>` used to print "doesn't exist" as a tracing warning
and then unconditionally show a green success line, even when the
dependency lived in a different table (`[pypi-dependencies]`, another
feature, a host/build section) and nothing was actually removed.
It now fails with a typed error and a help message that points at the
right place:
$ pixi remove polars
Error: x dependency `polars` was not found in dependencies
help: `polars` is a pypi-dependencies entry in the default feature; try
`pixi remove --pypi polars`
$ pixi remove --pypi polrs
Error: x dependency `polrs` was not found in pypi-dependencies
help: did you mean `polars`?
$ pixi remove numpy
Error: x dependency `numpy` was not found in dependencies
help: `numpy` is a dependencies entry in feature `dev`; try
`pixi remove --feature dev numpy`
The success line is only printed when something is actually removed.
The API surface is typed end-to-end: `Workspace::remove_dependency` /
`remove_pypi_dependency` return `RemoveDependencyError`, and the
`pixi_api` `remove_conda_deps` / `remove_pypi_deps` entry points return
a `RemoveError` enum with concrete variants per failure source
(`NotFound`, `PythonHasPypiDependencies`, `LoadWorkspace`, `Manifest`,
`Save`, `LockFileUpdate`). The CLI pattern-matches the typed result
and builds a `DependencyRemovalError` diagnostic for the `NotFound`
arm, with suggestions computed from the workspace manifest.
Adds inline-snapshot tests covering each suggestion edge case (wrong
dep type, wrong feature, host/build tables, typos, absent name) plus
tokio-driven tests that exercise the python guard and the not-found
path through the real API.
Fixes prefix-dev#3144
ruben-arts
approved these changes
May 28, 2026
Contributor
ruben-arts
left a comment
There was a problem hiding this comment.
Good improvement, I have some other ideas which I will write up in a different issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
pixi remove <name>used to print a misleading "doesn't exist" warning followed by a green success line, even when the dependency lived in a different table (for example[pypi-dependencies]instead of[dependencies]) and nothing was actually removed.It now fails with a clear error and a help message that points the user at the right place:
The success line is only printed when something was actually removed.
Fixes #3144
How Has This Been Tested?
pixi_clicover each suggestion edge case (wrong dep type, wrong feature, host/build tables, typos, absent name) plus the renderedRemoveErrorvariants (not-found, python guard, save failure).pixi_manifestunit tests still pass.cargo fmtandcargo clippyare clean on the touched crates.AI Disclosure
Tools: Claude Code
Checklist: