oraios/serena · error · RuntimeError

Unsupported architecture for foundry forge: {machine}

Error message

Unsupported architecture for foundry forge: {machine}

What it means

When mapping the CPU architecture to a foundry forge npm package, _get_forge_npm_package only recognizes x86_64/amd64 and arm64/aarch64. Any other platform.machine() value (e.g. i686, armv7l, riscv64) triggers this RuntimeError because Foundry does not publish forge binaries for those architectures.

Source

Thrown at src/solidlsp/language_servers/solidity_language_server.py:160

                    f"nomicfoundation-solidity-language-server executable not found at {solidity_executable_path}. "
                    "Something went wrong with the installation."
                )

            return solidity_executable_path

        @staticmethod
        def _get_forge_npm_package() -> str:
            """
            Returns the platform-specific @foundry-rs forge npm subpackage name. Installing
            the meta-package fails on Windows due to a POSIX-only postinstall script.
            """
            machine = platform.machine().lower()
            if machine in ("x86_64", "amd64"):
                arch = "amd64"
            elif machine in ("arm64", "aarch64"):
                arch = "arm64"
            else:
                raise RuntimeError(f"Unsupported architecture for foundry forge: {machine}")

            if os.name == "nt":
                if arch != "amd64":
                    raise RuntimeError(f"foundry forge does not publish a Windows {arch} npm package")
                return "@foundry-rs/forge-win32-amd64"
            if platform.system() == "Darwin":
                return f"@foundry-rs/forge-darwin-{arch}"
            return f"@foundry-rs/forge-linux-{arch}"

        def create_launch_command_env(self) -> dict[str, str]:
            solidity_language_server_version = self._custom_settings.get(
                "solidity_language_server_version", DEFAULT_SOLIDITY_LANGUAGE_SERVER_VERSION
            )
            forge_version = self._custom_settings.get("forge_version", DEFAULT_FORGE_VERSION)
            solidity_ls_dir = self._resolve_solidity_ls_dir(solidity_language_server_version, forge_version)
            managed_bin_dir = os.path.join(solidity_ls_dir, "node_modules", ".bin")
            return {"PATH": managed_bin_dir + os.pathsep + os.environ.get("PATH", "")}

View on GitHub (pinned to 7fcbca7e62)

Solutions

  1. Switch to a 64-bit OS/image (x86_64 or arm64) for the process and container.
  2. Run in an x86_64 emulation layer (e.g. Docker with --platform linux/amd64 under QEMU).
  3. Provide forge separately and adapt the launch command, or request/await an official forge package for your architecture.
  4. Use a hosted/devcontainer environment with a supported architecture.

Example fix

// before (32-bit container)
docker run 32bit/ubuntu
// after
docker run --platform linux/amd64 ubuntu:latest
Defensive patterns

Strategy: validation

Validate before calling

import platform
arch = platform.machine().lower()
if arch not in ("x86_64", "amd64", "arm64", "aarch64"):
    raise SystemExit(f"Foundry forge needs x86_64/arm64, got {arch}; run under 64-bit emulation")

Type guard

def forge_arch_supported() -> bool:
    import platform
    return platform.machine().lower() in ("x86_64", "amd64", "arm64", "aarch64")

Try / catch

try:
    server = SolidityLanguageServer(config, repo_root, settings)
except RuntimeError as e:
    if "Unsupported architecture" in str(e):
        raise SystemExit("Run on x86_64/arm64, or use Docker --platform linux/amd64") from e
    raise

Prevention

When it happens

Trigger: Starting the Solidity language server on a machine whose platform.machine() is not x86_64/amd64/arm64/aarch64 — typically 32-bit x86, ARMv7 SBCs (Raspberry Pi 32-bit OS), or uncommon architectures.

Common situations: Running inside a 32-bit Docker container on 64-bit hardware, Raspberry Pi OS (32-bit), or niche embedded/emulated environments.

Related errors


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