{"record":{"id":"6324a9cd3fb1d80a","repo":"oraios/serena","slug":"failed-to-find-start-editorservices-ps1-after-extr","errorCode":null,"errorMessage":"Failed to find Start-EditorServices.ps1 after extraction at {start_script}","messagePattern":"Failed to find Start-EditorServices\\.ps1 after extraction at (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/solidlsp/language_servers/powershell_language_server.py","lineNumber":156,"sourceCode":"            f\"https://github.com/PowerShell/PowerShellEditorServices/releases/download/v{pses_version}/PowerShellEditorServices.zip\"\n        )\n\n        # Create installation directory; legacy unversioned dir reserved for INITIAL only\n        install_dir = _pses_install_dir(cls.ls_resources_dir(solidlsp_settings), pses_version)\n        install_dir.mkdir(parents=True, exist_ok=True)\n\n        log.info(f\"Downloading PowerShell Editor Services from {download_url}...\")\n        FileUtils.download_and_extract_archive_verified(\n            download_url,\n            str(install_dir),\n            \"zip\",\n            expected_sha256=_pses_sha(pses_version),\n            allowed_hosts=PSES_ALLOWED_HOSTS,\n        )\n\n        start_script = install_dir / \"PowerShellEditorServices\" / \"Start-EditorServices.ps1\"\n        if not start_script.exists():\n            raise RuntimeError(f\"Failed to find Start-EditorServices.ps1 after extraction at {start_script}\")\n\n        log.info(f\"PowerShell Editor Services installed at: {install_dir}\")\n        return str(start_script)\n\n    @classmethod\n    def _setup_runtime_dependency(cls, solidlsp_settings: SolidLSPSettings) -> tuple[str, str, str]:\n        \"\"\"\n        Check if required PowerShell runtime dependencies are available.\n        Downloads PowerShell Editor Services if not present.\n\n        Returns:\n            tuple: (pwsh_path, start_script_path, bundled_modules_path)\n\n        \"\"\"\n        # Check for PowerShell Core\n        pwsh_path = cls._get_pwsh_path()\n        if not pwsh_path:\n            raise RuntimeError(","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/solidlsp/language_servers/powershell_language_server.py#L138-L174","documentation":"Serena downloads the pinned PowerShellEditorServices.zip from GitHub, verifies its sha256, and extracts it into a versioned install dir. Immediately afterwards it checks that PowerShellEditorServices/Start-EditorServices.ps1 exists at the expected relative path inside the extraction; if not, it raises this RuntimeError. It catches the case where the archive contents do not match the expected layout.","triggerScenarios":"Configuring ls_specific_settings['powershell']['pses_version'] to a release whose zip layout differs (no top-level PowerShellEditorServices/ dir wrapping Start-EditorServices.ps1), or extraction into install_dir failing silently so only part of the archive lands there.","commonSituations":"Overriding pses_version to an old/new PSES release with a different directory structure; a partially extracted or corrupted zip despite passing verification; leftover mixed contents in the install dir from a previous different-version install.","solutions":["Remove the pses_version override and use DEFAULT_PSES_VERSION, whose layout is verified by the pinned sha256.","Delete the versioned install dir (ls_resources/…/PowerShellEditorServices-<version>) and retry to force a clean download/extract.","Inspect the install dir and confirm the zip actually contains PowerShellEditorServices/Start-EditorServices.ps1.","Verify the release you pinned exists and check its archive structure on the PowerShellEditorServices releases page."],"exampleFix":"// before\n\"ls_specific_settings\": { \"powershell\": { \"pses_version\": \"2.0.0\" } }\n// after (use bundled default)\n\"ls_specific_settings\": { \"powershell\": {} }","handlingStrategy":"try-catch","validationCode":"import os\npses_version = 'latest-bundled-default'\nexpected = Path(os.environ['SERENA_LS_RESOURCES']) / f'PowerShellEditorServices-{pses_version}' / 'PowerShellEditorServices' / 'Start-EditorServices.ps1'\nprint(expected.exists())  # ensure False only triggers one clean download","typeGuard":null,"tryCatchPattern":"try:\n    server = SolidLanguageServer.create('powershell', repo_root, settings)\nexcept RuntimeError as e:\n    if 'Failed to find Start-EditorServices.ps1' in str(e):\n        shutil.rmtree(pses_install_dir, ignore_errors=True)\n        settings['ls_specific_settings']['powershell'].pop('pses_version', None)\n        server = SolidLanguageServer.create('powershell', repo_root, settings)\n    else:\n        raise","preventionTips":["Avoid overriding pses_version unless the release's zip layout matches (PowerShellEditorServices/Start-EditorServices.ps1 at that path).","Remove the versioned PSES install dir before switching versions.","Verify completed downloads — check the install dir contains the expected files before retrying."],"tags":["python","powershell","download","archive-extraction"],"backgroundTag":"missing-file-after-extraction","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}