astral-sh/uv · error

Source `{}` does not exist

Error message

Source `{}` does not exist

What it means

Raised by `uv build` when an explicit source path is given and tokio metadata() fails with io::ErrorKind::NotFound. uv absolutizes the path first, so the message shows the resolved path — it means the file or directory you asked to build genuinely is not on disk at that location.

Source

Thrown at crates/uv/src/commands/build_frontend.rs:316

        extra_build_dependencies,
        extra_build_variables,
        exclude_newer,
        link_mode,
        upgrade: _,
        build_options,
        sources,
        torch_backend: _,
        cuda_driver_version: _,
        amd_gpu_architecture: _,
    } = settings;

    // Determine the source to build.
    let src = if let Some(src) = src {
        let src = std::path::absolute(src)?;
        let metadata = match fs_err::tokio::metadata(&src).await {
            Ok(metadata) => metadata,
            Err(err) if err.kind() == io::ErrorKind::NotFound => {
                return Err(anyhow::anyhow!(
                    "Source `{}` does not exist",
                    src.user_display()
                ));
            }
            Err(err) => return Err(err.into()),
        };
        if metadata.is_file() {
            Source::File(Cow::Owned(src))
        } else {
            Source::Directory(Cow::Owned(src))
        }
    } else {
        Source::Directory(Cow::Borrowed(project_dir))
    };

    // Attempt to discover the workspace; on failure, save the error for later.
    let workspace = Workspace::discover(
        src.directory(),

View on GitHub (pinned to f1a42680ff)

Solutions

  1. Verify the path exists: `ls` the exact printed path and fix typos or casing.
  2. Check your working directory — uv resolves relative paths against cwd, so `cd` to the expected root or pass an absolute path.
  3. Regenerate the artifact if it was cleaned (e.g., re-run the step that produces the sdist) before `uv build` on it.
  4. Quote paths containing spaces or special characters in your shell.

Example fix

# before (run from repo root, package is in crates/)
uv build ./pkg  # -> Source `.../pkg` does not exist
# after
uv build ./crates/pkg
Defensive patterns

Strategy: validation

Validate before calling

# Rust: check existence before invoking the build
let src = std::path::absolute(src)?;
if !tokio::fs::try_exists(&src).await? {
    anyhow::bail!("build source missing: {}", src.display());
}
# Shell:
test -e "$SRC" || { echo "missing build source: $SRC" >&2; exit 1; }
uv build "$SRC"

Prevention

When it happens

Trigger: `uv build ./dist/pkg-1.0.tar.gz` when the sdist was cleaned or never built; typo in the path; running from the wrong working directory (relative path resolved against cwd); path with wrong casing on case-sensitive filesystems.

Common situations: CI scripts referencing an artifact path produced by an earlier step that failed or moved; shell quoting issues with paths containing spaces; rebuilding after `git clean`/`rm -rf dist` removed the referenced file.

Related errors


AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16). Data as JSON: /api/errors/40ac3cbc0cf09a26. Report an issue: GitHub.