Skip to content

Inconsistent behavior of format = "flat" between find-links and index-url in uv tool run #16051

@byeblack

Description

@byeblack

Question

I'm experiencing inconsistent behavior with format = "flat" between find-links and index-url when using uv tool run.

When installing and running an offline package using command-line flags with find-links, the tool fails to find the installed package:

❯ uv tool install --offline -n --no-config -f temp pip@25.0
Resolved 1 package in 2ms
Prepared 1 package in 71ms
Installed 1 package in 109ms
 + pip==25.0
Installed 3 executables: pip, pip3, pip3.12

❯ uv tool run --offline -n --no-config --from pip pip --version
  × No solution found when resolving tool dependencies:
  ╰─▶ Because pip was not found in the cache and you require pip, we can conclude that your requirements are unsatisfiable.

      hint: Packages were unavailable because the network was disabled. When the network is disabled, registry packages may only be read from the cache.

If I continue using -f to specify the path, it temporarily runs the pip package from the temp directory instead of the installed one:

❯ uv tool run --offline -n --no-config -f temp --from pip pip --version
Installed 1 package in 126ms
pip 25.2 ...

However, when using a uv.toml configuration file with index-url and format = "flat", everything works correctly:

# uv.toml
[[index]]
name = "local"
url = 'temp'
format = "flat"
❯ uv tool install --offline -n --config-file uv.toml pip@25.0
Resolved 1 package in 2ms
Prepared 1 package in 71ms
Installed 1 package in 109ms
 + pip==25.0
Installed 3 executables: pip, pip3, pip3.12

❯ uv tool run --offline -n --config-file uv.toml --from pip pip --version
pip 25.0 from ...

Comparing the uv-receipt.toml files reveals the difference:

# From: uv tool install --offline -n --no-config -f temp pip@25.0
[tool.options]
find-links = ["..."]
# From: uv tool install --offline -n --config-file uv.toml pip@25.0
[tool.options]
index = [
    { name = "local", url = "...", explicit = false, default = false, format = "flat", authenticate = "auto" },
]

In my opinion, The behavior should be consistent between these two approaches.

Platform

Windows 11 x86_64

Version

uv 0.8.22 (ade2bdb 2025-09-23)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionAsking for clarification or support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions