oraios/serena · critical

Could not find 'uvx' or 'uv' in PATH. Install uv (https://do

Error message

Could not find 'uvx' or 'uv' in PATH. Install uv (https://docs.astral.sh/uv/).

What it means

uvx-based dependency providers launch language servers via `uvx` (or `uv tool run`). _build_uvx_base_command raises RuntimeError when neither executable can be found on PATH, because the package simply cannot be started without uv installed.

Source

Thrown at src/solidlsp/dependency_provider.py:240

    ) -> list[str]:
        """Build a command that runs a pinned PyPI package's console script on demand via ``uvx`` / ``uv tool run``.

        :param package: PyPI package name (e.g. ``"pyright"``).
        :param version: Pinned package version.
        :param entrypoint: Console script provided by the package (e.g. ``"pyright-langserver"``).
        :param python_version: Python interpreter version passed via ``-p`` (uv will fetch it if missing).
        """
        base_args = ["-p", python_version, "--from", f"{package}=={version}", entrypoint]

        uvx_path = os.environ.get("UVX") or shutil.which("uvx")
        if uvx_path is not None:
            return [uvx_path, *base_args]

        uv_path = shutil.which("uv")
        if uv_path is not None:
            return [uv_path, "tool", "run", *base_args]  # `uv tool run` is the same as `uvx`

        raise RuntimeError("Could not find 'uvx' or 'uv' in PATH. Install uv (https://docs.astral.sh/uv/).")

    def _create_default_base_command(self):
        version = self._custom_settings.get(self._version_setting_key, self._default_version)
        return self._build_uvx_base_command(self._package, version, self._entrypoint)

    def _create_launch_command_from_base_command(self, base_command: list[str]) -> list[str]:
        return base_command + list(self._extra_args)


class DownloadedDependencyHashDatabase:
    RESOURCE_FILE_NAME = "downloaded_dependency_hashes.json"
    _instance: "DownloadedDependencyHashDatabase | None" = None
    _instance_lock: threading.Lock = threading.Lock()

    def __init__(self, _singleton: bool):
        self._json_file = os.path.join(SOLIDLSP_RESOURCES_DIR, self.RESOURCE_FILE_NAME)
        self._hashes = {}
        if os.path.exists(self._json_file):

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh (or pip install uv / brew install uv).
  2. Ensure the install location is on PATH for the process running the library (check ~/.local/bin in IDE/CI shells).
  3. Alternatively pin a custom base command in the language server settings to bypass uvx.

Example fix

// before (PATH missing uv)
export PATH=/usr/bin:/bin
// after
export PATH="$HOME/.local/bin:$PATH"  # after installing uv
Defensive patterns

Strategy: validation

Validate before calling

import shutil

def ensure_uv_available() -> None:
    if shutil.which('uvx') is None and shutil.which('uv') is None:
        raise EnvironmentError(
            "Install uv first: curl -LsSf https://astral.sh/uv/install.sh | sh, "
            "and ensure ~/.local/bin is on PATH"
        )

Type guard

def uv_on_path() -> bool:
    return shutil.which('uvx') is not None or shutil.which('uv') is not None

Try / catch

try:
    server = SolidLsp(...)  # uvx-backed language server
except RuntimeError as e:
    if "Could not find 'uvx' or 'uv' in PATH" in str(e):
        subprocess.run(['bash', '-c', 'curl -LsSf https://astral.sh/uv/install.sh | sh'], check=True)
        os.environ['PATH'] = f"{os.path.expanduser('~/.local/bin')}:{os.environ['PATH']}"
        server = SolidLsp(...)
    else:
        raise

Prevention

When it happens

Trigger: Initialising any language server backed by LanguageServerDependencyProviderUvx (e.g. pyright/others via uvx) on a machine where `shutil.which('uvx')` and `shutil.which('uv')` both return None.

Common situations: Fresh CI containers or minimal Docker images without uv; non-interactive shells (cron, IDE-spawned processes) with a restricted PATH that excludes ~/.local/bin or cargo-installed binaries.

Related errors


AI-assisted analysis of oraios/serena@7fcbca7e62 (2026-08-29). Data as JSON: /api/errors/1c32223ea6d2aa9f. Report an issue: GitHub.