Skip to content

uvx can't find executables on Windows when the package name contains a "." #15165

@crh23

Description

@crh23

Summary

Running (for example) uvx awslabs.cdk-mcp-server@latest on Windows will produce the error

error: Failed to spawn: `awslabs.cdk-mcp-server`
  Caused by: program not found

This can be worked around by running uvx --from awslabs.cdk-mcp-server@latest awslabs.cdk-mcp-server.exe, indicating that uv is not correctly finding the Windows executable.

I believe this is due to the extension guessing implementation found in

pub fn from_script_path(script_path: &Path, runnable_name: &OsStr) -> Command {
let script_path = script_path.join(runnable_name);
// Honor explicit extension if provided and recognized.
if let Some(script_type) = script_path
.extension()
.and_then(OsStr::to_str)
.and_then(Self::from_extension)
.filter(|_| script_path.is_file())
{
return script_type.as_command(&script_path);
}
// Guess the extension when an explicit one is not provided.
// We also add the extension when missing since for some types (e.g. PowerShell) it must be explicit.
Self::all()
.iter()
.map(|script_type| {
(
script_type,
script_path.with_extension(script_type.to_extension()),
)
})
.find(|(_, script_path)| script_path.is_file())
.map(|(script_type, script_path)| script_type.as_command(&script_path))
.unwrap_or_else(|| Command::new(runnable_name))
}
}

since

script_path.with_extension(script_type.to_extension())

will replace the "extension" found after the "." of the original script name, so instead of searching for awslabs.cdk-mcp-server.exe it will search for awslabs.exe (see the examples for with_extension).

Platform

Windows 11 x86_64

Version

uv 0.8.0 (0b23572 2025-07-17)

Python version

Python 3.12.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedContribution especially encouraged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions