nodejs/node · error · SystemError

invalid sysconfig.get_config_var('EXT_SUFFIX')

Error message

invalid sysconfig.get_config_var('EXT_SUFFIX')

What it means

SystemError raised by packaging.tags when sysconfig.get_config_var('EXT_SUFFIX') returns a value that is not a non-empty string beginning with '.'. The function relies on EXT_SUFFIX to derive the running interpreter's ABI tag (e.g. cp310), so a malformed value means tag inference cannot proceed safely.

Source

Thrown at tools/gyp/pylib/packaging/tags.py:234

def _generic_abi() -> List[str]:
    """
    Return the ABI tag based on EXT_SUFFIX.
    """
    # The following are examples of `EXT_SUFFIX`.
    # We want to keep the parts which are related to the ABI and remove the
    # parts which are related to the platform:
    # - linux:   '.cpython-310-x86_64-linux-gnu.so' => cp310
    # - mac:     '.cpython-310-darwin.so'           => cp310
    # - win:     '.cp310-win_amd64.pyd'             => cp310
    # - win:     '.pyd'                             => cp37 (uses _cpython_abis())
    # - pypy:    '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73
    # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'
    #                                               => graalpy_38_native

    ext_suffix = _get_config_var("EXT_SUFFIX", warn=True)
    if not isinstance(ext_suffix, str) or ext_suffix[0] != ".":
        raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")
    parts = ext_suffix.split(".")
    if len(parts) < 3:
        # CPython3.7 and earlier uses ".pyd" on Windows.
        return _cpython_abis(sys.version_info[:2])
    soabi = parts[1]
    if soabi.startswith("cpython"):
        # non-windows
        abi = "cp" + soabi.split("-")[1]
    elif soabi.startswith("cp"):
        # windows
        abi = soabi.split("-")[0]
    elif soabi.startswith("pypy"):
        abi = "-".join(soabi.split("-")[:2])
    elif soabi.startswith("graalpy"):
        abi = "-".join(soabi.split("-")[:3])
    elif soabi:
        # pyston, ironpython, others?
        abi = soabi

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Run `python -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"` to inspect the actual value.
  2. Reinstall or rebuild the Python interpreter from a standard distribution so EXT_SUFFIX is set correctly.
  3. If unavoidable, call packaging.tags functions that accept explicit interpreter/platform arguments rather than auto-detection, or pin to a known-good interpreter in CI.

Example fix

# before (auto-derive on a broken interpreter)
from packaging.tags import sys_tags
abi = next(iter(sys_tags())).abi

# after
import sysconfig
ext = sysconfig.get_config_var('EXT_SUFFIX')
assert isinstance(ext, str) and ext.startswith('.'), ext
from packaging.tags import sys_tags
Defensive patterns

Strategy: validation

Validate before calling

import sysconfig
def has_valid_ext_suffix() -> bool:
    ext = sysconfig.get_config_var('EXT_SUFFIX')
    return isinstance(ext, str) and ext.startswith('.')

Try / catch

try:
    from packaging.tags import sys_tags
    tags = list(sys_tags())
except SystemError as e:
    if 'EXT_SUFFIX' in str(e):
        pass  # fall back to explicit interpreter/platform tags

Prevention

When it happens

Trigger: Running on a Python build where EXT_SUFFIX is None, empty, or lacks the leading dot - typically a broken, stripped, or unusual embeddable distribution, or a Python compiled without shared-module support. The warn=True _get_config_var already emitted a warning before this guard fires.

Common situations: Custom or embedded Python builds (e.g. conda variants, pyenv builds with odd configure flags, musl builds), CI images with a minimal Python, or environments where sysconfig data is incomplete.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/4b35fc2c244cff68. Report an issue: GitHub.