{"record":{"id":"1c32223ea6d2aa9f","repo":"oraios/serena","slug":"could-not-find-uvx-or-uv-in-path-install-uv","errorCode":null,"errorMessage":"Could not find 'uvx' or 'uv' in PATH. Install uv (https://docs.astral.sh/uv/).","messagePattern":"Could not find 'uvx' or 'uv' in PATH\\. Install uv \\(https://docs\\.astral\\.sh/uv/\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/solidlsp/dependency_provider.py","lineNumber":240,"sourceCode":"    ) -> list[str]:\n        \"\"\"Build a command that runs a pinned PyPI package's console script on demand via ``uvx`` / ``uv tool run``.\n\n        :param package: PyPI package name (e.g. ``\"pyright\"``).\n        :param version: Pinned package version.\n        :param entrypoint: Console script provided by the package (e.g. ``\"pyright-langserver\"``).\n        :param python_version: Python interpreter version passed via ``-p`` (uv will fetch it if missing).\n        \"\"\"\n        base_args = [\"-p\", python_version, \"--from\", f\"{package}=={version}\", entrypoint]\n\n        uvx_path = os.environ.get(\"UVX\") or shutil.which(\"uvx\")\n        if uvx_path is not None:\n            return [uvx_path, *base_args]\n\n        uv_path = shutil.which(\"uv\")\n        if uv_path is not None:\n            return [uv_path, \"tool\", \"run\", *base_args]  # `uv tool run` is the same as `uvx`\n\n        raise RuntimeError(\"Could not find 'uvx' or 'uv' in PATH. Install uv (https://docs.astral.sh/uv/).\")\n\n    def _create_default_base_command(self):\n        version = self._custom_settings.get(self._version_setting_key, self._default_version)\n        return self._build_uvx_base_command(self._package, version, self._entrypoint)\n\n    def _create_launch_command_from_base_command(self, base_command: list[str]) -> list[str]:\n        return base_command + list(self._extra_args)\n\n\nclass DownloadedDependencyHashDatabase:\n    RESOURCE_FILE_NAME = \"downloaded_dependency_hashes.json\"\n    _instance: \"DownloadedDependencyHashDatabase | None\" = None\n    _instance_lock: threading.Lock = threading.Lock()\n\n    def __init__(self, _singleton: bool):\n        self._json_file = os.path.join(SOLIDLSP_RESOURCES_DIR, self.RESOURCE_FILE_NAME)\n        self._hashes = {}\n        if os.path.exists(self._json_file):","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/dependency_provider.py#L222-L258","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh (or pip install uv / brew install uv).","Ensure the install location is on PATH for the process running the library (check ~/.local/bin in IDE/CI shells).","Alternatively pin a custom base command in the language server settings to bypass uvx."],"exampleFix":"// before (PATH missing uv)\nexport PATH=/usr/bin:/bin\n// after\nexport PATH=\"$HOME/.local/bin:$PATH\"  # after installing uv","handlingStrategy":"validation","validationCode":"import shutil\n\ndef ensure_uv_available() -> None:\n    if shutil.which('uvx') is None and shutil.which('uv') is None:\n        raise EnvironmentError(\n            \"Install uv first: curl -LsSf https://astral.sh/uv/install.sh | sh, \"\n            \"and ensure ~/.local/bin is on PATH\"\n        )","typeGuard":"def uv_on_path() -> bool:\n    return shutil.which('uvx') is not None or shutil.which('uv') is not None","tryCatchPattern":"try:\n    server = SolidLsp(...)  # uvx-backed language server\nexcept RuntimeError as e:\n    if \"Could not find 'uvx' or 'uv' in PATH\" in str(e):\n        subprocess.run(['bash', '-c', 'curl -LsSf https://astral.sh/uv/install.sh | sh'], check=True)\n        os.environ['PATH'] = f\"{os.path.expanduser('~/.local/bin')}:{os.environ['PATH']}\"\n        server = SolidLsp(...)\n    else:\n        raise","preventionTips":["Install uv in your Dockerfile/CI setup image before running the app.","Extend PATH with ~/.local/bin for non-interactive shells (cron, IDE-spawned processes).","Add a startup health check that verifies required external tools exist before initialising language servers."],"tags":["environment","path","uv","language-server"],"backgroundTag":"missing-executable-on-path","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}