{"record":{"id":"2eebe3ec7a3f78bd","repo":"python/cpython","slug":"don-t-know-machine-value-for-archs-r","errorCode":null,"errorMessage":"Don't know machine value for archs=%r","messagePattern":"Don't know machine value for archs=%r","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Lib/_osx_support.py","lineNumber":562,"sourceCode":"            archs = re.findall(r'-arch\\s+(\\S+)', cflags)\n            archs = tuple(sorted(set(archs)))\n\n            if len(archs) == 1:\n                machine = archs[0]\n            elif archs == ('arm64', 'x86_64'):\n                machine = 'universal2'\n            elif archs == ('i386', 'ppc'):\n                machine = 'fat'\n            elif archs == ('i386', 'x86_64'):\n                machine = 'intel'\n            elif archs == ('i386', 'ppc', 'x86_64'):\n                machine = 'fat3'\n            elif archs == ('ppc64', 'x86_64'):\n                machine = 'fat64'\n            elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):\n                machine = 'universal'\n            else:\n                raise ValueError(\n                   \"Don't know machine value for archs=%r\" % (archs,))\n\n        elif machine == 'i386':\n            # On OSX the machine type returned by uname is always the\n            # 32-bit variant, even if the executable architecture is\n            # the 64-bit variant\n            if sys.maxsize >= 2**32:\n                machine = 'x86_64'\n\n        elif machine in ('PowerPC', 'Power_Macintosh'):\n            # Pick a sane name for the PPC architecture.\n            # See 'i386' case\n            if sys.maxsize >= 2**32:\n                machine = 'ppc64'\n            else:\n                machine = 'ppc'\n\n    return (osname, release, machine)","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/python/cpython/blob/bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6/Lib/_osx_support.py#L544-L580","documentation":"Raised in _osx_support while normalizing the macOS machine/platform name from the ARCHFLAGS architecture list. Only a fixed table of architecture tuples maps to a machine value — ('arm64','x86_64') -> universal2, ('i386','ppc') -> fat, ('i386','x86_64') -> intel, ('i386','ppc','x86_64') -> fat3, ('ppc64','x86_64') -> fat64, ('i386','ppc','ppc64','x86_64') -> universal. Any other combination raises ValueError('Don't know machine value for archs=%r'). It guards against unsupported universal-build architecture sets.","triggerScenarios":"Setting the ARCHFLAGS environment variable to an architecture combination outside the supported table — e.g. ARCHFLAGS='-arch ppc -arch arm64', a single legacy arch like '-arch ppc7400', or a reordered/duplicated set like 'arm64 arm64 x86_64' — then triggering platform/compiler customization (building extensions, sysconfig.get_platform() on macOS).","commonSituations":"ARCHFLAGS copied from old build docs or a Linux CI script; cross-compile experiments mixing ppc with modern arm64; fat-binary instructions from the PowerPC era; ARCHFLAGS inherited from a shell profile across macOS upgrades; single-arch values that don't hit the x86_64 default path.","solutions":["Unset ARCHFLAGS and let the build use the interpreter's defaults: `unset ARCHFLAGS`","If you must pin arches, use a supported set: ARCHFLAGS='-arch arm64 -arch x86_64' (universal2) or a single '-arch arm64' / '-arch x86_64'","Check for stray whitespace/duplicates/order variations in ARCHFLAGS and normalize the tuple","Upgrade setuptools/pip so platform detection uses current macOS logic instead of stale vendored copies"],"exampleFix":"# before\nexport ARCHFLAGS='-arch i386 -arch ppc -arch arm64'   # ValueError\n\n# after\nunset ARCHFLAGS\n# or a supported combination:\nexport ARCHFLAGS='-arch arm64 -arch x86_64'","handlingStrategy":"validation","validationCode":"SUPPORTED = {\n    ('arm64', 'x86_64'), ('i386', 'ppc'), ('i386', 'x86_64'),\n    ('i386', 'ppc', 'x86_64'), ('ppc64', 'x86_64'),\n    ('i386', 'ppc', 'ppc64', 'x86_64'),\n}\n\ndef validate_archflags(archflags: str) -> None:\n    import shlex\n    archs = tuple(a for a in shlex.split(archflags) if a == '-arch') and tuple(\n        shlex.split(archflags)[i + 1] for i, a in enumerate(shlex.split(archflags)) if a == '-arch'\n    ) or ()\n    if archs and archs not in SUPPORTED:\n        raise ValueError(f'Unsupported ARCHFLAGS arch set {archs}; use e.g. arm64+x86_64 or unset ARCHFLAGS')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Leave ARCHFLAGS unset unless you specifically need a universal build","If pinning arches, restrict to single-arch or the universal2 pair arm64+x86_64","Validate ARCHFLAGS at the top of macOS CI jobs, not mid-build","Keep macOS build scripts on recent pip/setuptools so platform detection matches current arch tables"],"tags":["macos","architecture","build","archflags","environment"],"backgroundTag":null,"analyzedSha":"bc6749cc3b5ae4a5e88a6cc2d5b3bebbe354eae6","analyzedAt":"2026-08-14T22:01:13.976Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}