dotnet/runtime · error · RuntimeError

Unsupported OS.

Error message

Unsupported OS.

What it means

Thrown by SuperPMICollect.__init__() in superpmi.py when coreclr_args.host_os is not 'osx', 'linux', or 'windows'. The host OS determines the name of the SuperPMI collection shim shared library (e.g., libsuperpmi-shim-collector.so vs superpmi-shim-collector.dll), and an unrecognized OS means the shim filename cannot be determined.

Source

Thrown at src/coreclr/scripts/superpmi.py:693

        Args:
            coreclr_args (CoreclrArguments) : parsed args

        """

        self.core_root = coreclr_args.core_root

        if coreclr_args.host_os == "osx":
            self.collection_shim_name = "libsuperpmi-shim-collector.dylib"
            self.corerun_tool_name = "corerun"
        elif coreclr_args.host_os == "linux":
            self.collection_shim_name = "libsuperpmi-shim-collector.so"
            self.corerun_tool_name = "corerun"
        elif coreclr_args.host_os == "windows":
            self.collection_shim_name = "superpmi-shim-collector.dll"
            self.corerun_tool_name = "corerun.exe"
        else:
            raise RuntimeError("Unsupported OS.")

        self.collection_shim_path = os.path.join(self.core_root, self.collection_shim_name)

        jit_name = get_jit_name(coreclr_args)
        self.jit_path = os.path.join(coreclr_args.core_root, jit_name)

        self.superpmi_path = determine_superpmi_tool_path(coreclr_args)
        self.mcs_path = determine_mcs_tool_path(coreclr_args)

        self.collection_command = coreclr_args.collection_command
        self.collection_args = coreclr_args.collection_args

        if coreclr_args.pmi:
            self.pmi_location = determine_pmi_location(coreclr_args)
            self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

        if coreclr_args.crossgen2:
            self.corerun = os.path.join(self.core_root, self.corerun_tool_name)

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Check -host_os and ensure it is exactly 'windows', 'linux', or 'osx'.
  2. Verify the auto-detected OS by checking what CoreclrArguments populates for host_os.
  3. If you genuinely need SuperPMI on a new OS, add the appropriate shim name and corerun tool name in the if/elif chain.

Example fix

# before: unsupported host OS
python superpmi.py collect -host_os darwin

# after: use correct OS identifier
python superpmi.py collect -host_os osx
Defensive patterns

Strategy: validation

Validate before calling

# Validate host_os before constructing SuperPMICollect
valid_oses = {'osx', 'linux', 'windows'}
if coreclr_args.host_os not in valid_oses:
    raise ValueError(f'Unsupported OS for SuperPMI collect: {coreclr_args.host_os}. Must be one of: {valid_oses}')

Type guard

def is_supported_superpmi_os(host_os: str) -> bool:
    return host_os in {'osx', 'linux', 'windows'}

Try / catch

try:
    collector = SuperPMICollect(coreclr_args)
except RuntimeError as e:
    if 'Unsupported OS' in str(e):
        logging.error('SuperPMI collect supports windows, linux, and osx only')
        sys.exit(1)
    raise

Prevention

When it happens

Trigger: In SuperPMICollect.__init__() at lines 683-693: the if/elif chain checks host_os for 'osx', 'linux', 'windows' to set collection_shim_name and corerun_tool_name. If none match, line 693 raises. This is triggered when running 'superpmi.py collect' with an unsupported OS.

Common situations: Running on an unsupported OS (e.g., FreeBSD). The -host_os argument is misspelled or set to an invalid value. Platform auto-detection returned an unexpected string (e.g., 'darwin' instead of 'osx', though the detection logic should handle this).

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/c495c8ae29d59776. Report an issue: GitHub.