oraios/serena · error · RuntimeError

Expected exactly one runtime dependency for platform-{Platfo

Error message

Expected exactly one runtime dependency for platform-{PlatformUtils.get_platform_id().value} and {dependency_id=}, found {len(deps)}

What it means

Raised by get_single_dep_for_current_platform when the number of runtime dependencies resolved for the current platform is not exactly one (it can also be filtered by dependency_id). The library expects a 1:1 mapping between platform and runtime dependency; 0 means no support for that platform, >1 means ambiguous configuration.

Source

Thrown at src/solidlsp/language_servers/common.py:73

            base_dep = self._id_and_platform_id_to_dep.get(override_key)
            if base_dep is None:
                new_runtime_dep = RuntimeDependency(**dep_values_override)
                self._id_and_platform_id_to_dep[override_key] = new_runtime_dep
            else:
                self._id_and_platform_id_to_dep[override_key] = replace(base_dep, **dep_values_override)

    def get_dependencies_for_platform(self, platform_id: str) -> list[RuntimeDependency]:
        return [d for d in self._id_and_platform_id_to_dep.values() if d.platform_id in (platform_id, "any", "platform-agnostic", None)]

    def get_dependencies_for_current_platform(self) -> list[RuntimeDependency]:
        return self.get_dependencies_for_platform(PlatformUtils.get_platform_id().value)

    def get_single_dep_for_current_platform(self, dependency_id: str | None = None) -> RuntimeDependency:
        deps = self.get_dependencies_for_current_platform()
        if dependency_id is not None:
            deps = [d for d in deps if d.id == dependency_id]
        if len(deps) != 1:
            raise RuntimeError(
                f"Expected exactly one runtime dependency for platform-{PlatformUtils.get_platform_id().value} and {dependency_id=}, found {len(deps)}"
            )
        return deps[0]

    def binary_path(self, target_dir: str) -> str:
        dep = self.get_single_dep_for_current_platform()
        if not dep.binary_name:
            return target_dir
        return os.path.join(target_dir, dep.binary_name)

    def install(self, target_dir: str) -> dict[str, str]:
        """Install all dependencies for the current platform into *target_dir*.

        Returns a mapping from dependency id to the resolved binary path.
        """
        os.makedirs(target_dir, exist_ok=True)
        results: dict[str, str] = {}
        for dep in self.get_dependencies_for_current_platform():

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Check PlatformUtils.get_platform_id().value and confirm the language server publishes a binary for your platform
  2. Upgrade to a version of the library that includes a runtime dependency entry for your platform
  3. If multiple deps are returned, pass an explicit dependency_id to disambiguate or fix the duplicated dependency definitions
  4. Build/obtain the language server manually and bypass the auto-installer if your platform is genuinely unsupported

Example fix

// before: RuntimeError "... found 0"
// running on unsupported platform
// after: run on supported platform (linux-x86_64, darwin-arm64, windows) or install the LS manually and point the config at it
Defensive patterns

Strategy: validation

Validate before calling

from solidlsp.language_servers.common import RuntimeDependencyCollection, PlatformUtils
deps = collection.get_dependencies_for_current_platform()
if len(deps) == 0:
    raise SystemExit(f"No runtime dependency for platform {PlatformUtils.get_platform_id().value}; install the LS manually")
if len(deps) > 1:
    print(f"Ambiguous deps {[d.id for d in deps]}; pick one explicitly via dependency_id")

Type guard

def has_unique_platform_dep(collection, dependency_id=None) -> bool:
    deps = collection.get_dependencies_for_current_platform()
    if dependency_id is not None:
        deps = [d for d in deps if d.id == dependency_id]
    return len(deps) == 1

Try / catch

try:
    dep = collection.get_single_dep_for_current_platform()
except RuntimeError as e:
    print(f"Platform dependency resolution failed: {e}; falling back to manual LS install")
    dep = None  # proceed with manual installation path

Prevention

When it happens

Trigger: Any language server setup path (_get_or_install_core_dependency, binary_path, _ensure_server_installed, _atomic_install, _setup_runtime_dependencies) calling get_single_dep_for_current_platform when the RuntimeDependencyCollection yields zero deps for PlatformUtils.get_platform_id() (unsupported OS/arch) or multiple deps (misconfigured dependency table, duplicated dependency_id entries).

Common situations: Running on an OS/architecture with no published language-server binary (e.g. Alpine/musl, ARM Linux for servers that only ship x64 binaries), or a locally patched/overridden dependency manifest listing two artifacts for the same platform.

Related errors


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