Skip to content

poor error message with uv add -r on a requirements.txt with a -e entry that has a bad path #16582

@tsudol-plaid

Description

@tsudol-plaid

Summary

Let's say our project is set up like this:

proj/
- pyproject.toml
- requirements.txt
foo.lib/
  - pyproject.toml

And our requirements.txt contains:

-e file:foo.lib

That path for foo.lib in requirements.txt is incorrect, because the path should be relative, e.g. ../foo.lib.

However, instead of saying that the path is wrong, uv complains that:

error: Couldn't parse requirement in `requirements.txt` at position 3
  Caused by: Expected path (`foo.lib`) to end in a supported file extension: `.whl`, `.tar.gz`, `.zip`, `.tar.bz2`, `.tar.lz`, `.tar.lzma`, `.tar.xz`, `.tar.zst`, `.tar`, `.tbz`, `.tgz`, `.tlz`, or `.txz`
file:foo.lib
^^^^^^^^^^^^

Presumably uv is treating the path as a file because of the .lib at the end.

Contrast this with the error message when we replace the . with a _:

error: Distribution not found at: file:///private/tmp/test/foo_lib

This is a lot better. (Tho it does require you to know what a "distribution" is.)


Steps to reproduce:

  1. uv init test && cd test
  2. echo "-e file:foo.lib" >> requirements.txt
  3. uv add -r requirements.txt

Platform

Darwin 24.6.0 arm64

Version

uv 0.9.6 (Homebrew 2025-10-29)

Python version

Python 3.10.16

Metadata

Metadata

Assignees

Labels

error messagesMessaging when something goes wrong

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions