Skip to content

Bad error message when pyproject.toml for group doesn't exist #15789

@konstin

Description

@konstin

uv shows an incorrect error message when the pyproject.toml for a group doesn't exist, but somewhere above it there's a pyproject.toml that isn't usable (but should not have been checked in the first place):

[project]
name = "uv"
version = "0.8.17"

[tool.uv]
managed = false
$ uv pip compile --group does/not/exist/pyproject.toml:dev
error: Failed to read dependency groups from: does/not/exist/pyproject.toml
  Caused by: The project is marked as unmanaged: `/home/konsti/projects/foo`

Similarly, with an invalid pyproject.toml that's unrelated to out attempt at reading a dependency group:

[project]
name = "uv%%%"
version = "0.8.17"
$ uv pip compile --group does/not/exist/pyproject.toml:dev
error: Failed to read dependency groups from: does/not/exist/pyproject.toml
  Caused by: Failed to parse: `pyproject.toml`
  Caused by: TOML parse error at line 2, column 8
  |
2 | name = "uv%%%"
  |        ^^^^^^^
Not a valid package or extra name: "uv%%%". Names must start and end with a letter or digit and may only contain -, _, ., and alphanumeric characters.

We shouldn't read that pyproject.toml at all, we should error directly when we don't find does/not/exist/pyproject.toml.

Metadata

Metadata

Assignees

Labels

error messagesMessaging when something goes wronghelp wantedContribution especially encouraged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions