astral-sh/ruff · error

InternalError

InternalError

Error message

uv was not found; is it installed and on the PATH?

What it means

The ruff LSP server was configured to format via the external uv backend (FormatBackend::Uv) and tried to spawn a `uv` process, but the OS returned ENOENT: no executable named uv exists in the server process's PATH. Note the PATH seen by the server is the one inherited from how the editor was launched, which often differs from a terminal's PATH.

Source

Thrown at crates/ruff_server/src/format.rs:315

        command.stdout(Stdio::piped());
        command.stderr(Stdio::piped());

        command
    }

    /// Execute the format command on the given source.
    fn format(
        &self,
        source: &str,
        path: &Path,
        range_with_index: Option<(TextRange, &LineIndex)>,
    ) -> crate::Result<FormatResult> {
        let mut command =
            self.build_command(path, range_with_index.map(|(r, idx)| (r, idx, source)));
        let mut child = match command.spawn() {
            Ok(child) => child,
            Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
                anyhow::bail!("uv was not found; is it installed and on the PATH?")
            }
            Err(err) => return Err(err).context("Failed to spawn uv"),
        };

        let mut stdin = child
            .stdin
            .take()
            .context("Failed to get stdin from format subprocess")?;
        stdin
            .write_all(source.as_bytes())
            .context("Failed to write to stdin")?;
        drop(stdin);

        let result = child
            .wait_with_output()
            .context("Failed to get output from format subprocess")?;

        if !result.status.success() {

View on GitHub (pinned to d1087a4b9e)

Solutions

  1. Install uv (e.g. `curl -LsSf https://astral.sh/uv/install.sh | sh`, `pip install uv`, or `brew install uv`)
  2. Restart the editor completely after installing so it inherits the updated PATH (reloading the window is not enough)
  3. Or switch the format backend setting back to the built-in `internal` formatter, which needs no external process

Example fix

# verify what the editor-side PATH contains, then install
which uv || curl -LsSf https://astral.sh/uv/install.sh | sh
# fully quit and reopen the editor, then format again
Defensive patterns

Strategy: validation

Validate before calling

# check the editor-side PATH has uv before selecting the uv format backend
command -v uv >/dev/null 2>&1 || echo "uv missing on PATH — install it or use the internal backend"

Prevention

When it happens

Trigger: Selecting the uv format backend in editor settings without uv installed; uv installed via a shell profile (export PATH=...) that GUI-launched editors never source; servers launched by systemd/containers with a minimal PATH.

Common situations: macOS: editor launched from Dock/Spotlight misses Homebrew/user-local PATH entries; remote development containers or devcontainers without uv; CI environments running the LSP harness without uv in the image.

Related errors


AI-assisted analysis of astral-sh/ruff@d1087a4b9e (2026-08-20). Data as JSON: /api/errors/b53f9bdedaf86d6e. Report an issue: GitHub.