oraios/serena · error · RuntimeError

Failed to find Start-EditorServices.ps1 after extraction at

Error message

Failed to find Start-EditorServices.ps1 after extraction at {start_script}

What it means

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.

Source

Thrown at src/solidlsp/language_servers/powershell_language_server.py:156

            f"https://github.com/PowerShell/PowerShellEditorServices/releases/download/v{pses_version}/PowerShellEditorServices.zip"
        )

        # Create installation directory; legacy unversioned dir reserved for INITIAL only
        install_dir = _pses_install_dir(cls.ls_resources_dir(solidlsp_settings), pses_version)
        install_dir.mkdir(parents=True, exist_ok=True)

        log.info(f"Downloading PowerShell Editor Services from {download_url}...")
        FileUtils.download_and_extract_archive_verified(
            download_url,
            str(install_dir),
            "zip",
            expected_sha256=_pses_sha(pses_version),
            allowed_hosts=PSES_ALLOWED_HOSTS,
        )

        start_script = install_dir / "PowerShellEditorServices" / "Start-EditorServices.ps1"
        if not start_script.exists():
            raise RuntimeError(f"Failed to find Start-EditorServices.ps1 after extraction at {start_script}")

        log.info(f"PowerShell Editor Services installed at: {install_dir}")
        return str(start_script)

    @classmethod
    def _setup_runtime_dependency(cls, solidlsp_settings: SolidLSPSettings) -> tuple[str, str, str]:
        """
        Check if required PowerShell runtime dependencies are available.
        Downloads PowerShell Editor Services if not present.

        Returns:
            tuple: (pwsh_path, start_script_path, bundled_modules_path)

        """
        # Check for PowerShell Core
        pwsh_path = cls._get_pwsh_path()
        if not pwsh_path:
            raise RuntimeError(

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Remove the pses_version override and use DEFAULT_PSES_VERSION, whose layout is verified by the pinned sha256.
  2. Delete the versioned install dir (ls_resources/…/PowerShellEditorServices-<version>) and retry to force a clean download/extract.
  3. Inspect the install dir and confirm the zip actually contains PowerShellEditorServices/Start-EditorServices.ps1.
  4. Verify the release you pinned exists and check its archive structure on the PowerShellEditorServices releases page.

Example fix

// before
"ls_specific_settings": { "powershell": { "pses_version": "2.0.0" } }
// after (use bundled default)
"ls_specific_settings": { "powershell": {} }
Defensive patterns

Strategy: try-catch

Validate before calling

import os
pses_version = 'latest-bundled-default'
expected = Path(os.environ['SERENA_LS_RESOURCES']) / f'PowerShellEditorServices-{pses_version}' / 'PowerShellEditorServices' / 'Start-EditorServices.ps1'
print(expected.exists())  # ensure False only triggers one clean download

Try / catch

try:
    server = SolidLanguageServer.create('powershell', repo_root, settings)
except RuntimeError as e:
    if 'Failed to find Start-EditorServices.ps1' in str(e):
        shutil.rmtree(pses_install_dir, ignore_errors=True)
        settings['ls_specific_settings']['powershell'].pop('pses_version', None)
        server = SolidLanguageServer.create('powershell', repo_root, settings)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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