{"record":{"id":"ad0a60ed7e617803","repo":"oraios/serena","slug":"expected-exactly-one-runtime-dependency-for-platfo","errorCode":null,"errorMessage":"Expected exactly one runtime dependency for platform-{PlatformUtils.get_platform_id().value} and {dependency_id=}, found {len(deps)}","messagePattern":"Expected exactly one runtime dependency for platform-(.+?) and (.+?), found (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/common.py","lineNumber":73,"sourceCode":"            base_dep = self._id_and_platform_id_to_dep.get(override_key)\n            if base_dep is None:\n                new_runtime_dep = RuntimeDependency(**dep_values_override)\n                self._id_and_platform_id_to_dep[override_key] = new_runtime_dep\n            else:\n                self._id_and_platform_id_to_dep[override_key] = replace(base_dep, **dep_values_override)\n\n    def get_dependencies_for_platform(self, platform_id: str) -> list[RuntimeDependency]:\n        return [d for d in self._id_and_platform_id_to_dep.values() if d.platform_id in (platform_id, \"any\", \"platform-agnostic\", None)]\n\n    def get_dependencies_for_current_platform(self) -> list[RuntimeDependency]:\n        return self.get_dependencies_for_platform(PlatformUtils.get_platform_id().value)\n\n    def get_single_dep_for_current_platform(self, dependency_id: str | None = None) -> RuntimeDependency:\n        deps = self.get_dependencies_for_current_platform()\n        if dependency_id is not None:\n            deps = [d for d in deps if d.id == dependency_id]\n        if len(deps) != 1:\n            raise RuntimeError(\n                f\"Expected exactly one runtime dependency for platform-{PlatformUtils.get_platform_id().value} and {dependency_id=}, found {len(deps)}\"\n            )\n        return deps[0]\n\n    def binary_path(self, target_dir: str) -> str:\n        dep = self.get_single_dep_for_current_platform()\n        if not dep.binary_name:\n            return target_dir\n        return os.path.join(target_dir, dep.binary_name)\n\n    def install(self, target_dir: str) -> dict[str, str]:\n        \"\"\"Install all dependencies for the current platform into *target_dir*.\n\n        Returns a mapping from dependency id to the resolved binary path.\n        \"\"\"\n        os.makedirs(target_dir, exist_ok=True)\n        results: dict[str, str] = {}\n        for dep in self.get_dependencies_for_current_platform():","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/common.py#L55-L91","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check PlatformUtils.get_platform_id().value and confirm the language server publishes a binary for your platform","Upgrade to a version of the library that includes a runtime dependency entry for your platform","If multiple deps are returned, pass an explicit dependency_id to disambiguate or fix the duplicated dependency definitions","Build/obtain the language server manually and bypass the auto-installer if your platform is genuinely unsupported"],"exampleFix":"// before: RuntimeError \"... found 0\"\n// running on unsupported platform\n// after: run on supported platform (linux-x86_64, darwin-arm64, windows) or install the LS manually and point the config at it","handlingStrategy":"validation","validationCode":"from solidlsp.language_servers.common import RuntimeDependencyCollection, PlatformUtils\ndeps = collection.get_dependencies_for_current_platform()\nif len(deps) == 0:\n    raise SystemExit(f\"No runtime dependency for platform {PlatformUtils.get_platform_id().value}; install the LS manually\")\nif len(deps) > 1:\n    print(f\"Ambiguous deps {[d.id for d in deps]}; pick one explicitly via dependency_id\")\n","typeGuard":"def has_unique_platform_dep(collection, dependency_id=None) -> bool:\n    deps = collection.get_dependencies_for_current_platform()\n    if dependency_id is not None:\n        deps = [d for d in deps if d.id == dependency_id]\n    return len(deps) == 1\n","tryCatchPattern":"try:\n    dep = collection.get_single_dep_for_current_platform()\nexcept RuntimeError as e:\n    print(f\"Platform dependency resolution failed: {e}; falling back to manual LS install\")\n    dep = None  # proceed with manual installation path\n","preventionTips":["Verify your OS/arch against the supported platform matrix before using auto-install","Keep dependency manifests free of duplicate platform entries","Provide an explicit dependency_id when multiple artifacts exist for a platform","For unsupported platforms (musl/ARM variants), pre-install the language server manually"],"tags":["platform","dependency-setup","configuration"],"backgroundTag":"unsupported-platform-artifact","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}