{"record":{"id":"6cf50a601d5e19ed","repo":"ungoogled-software/ungoogled-chromium","slug":"notimplementederror","errorCode":null,"errorMessage":"NotImplementedError","messagePattern":"NotImplementedError","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"utils/_extraction.py","lineNumber":236,"sourceCode":"        # Use WinRAR if 7-zip is not found\n        winrar_cmd = extractors.get(ExtractorEnum.WINRAR)\n        if winrar_cmd == USE_REGISTRY:\n            winrar_cmd = str(_find_winrar_by_registry())\n        winrar_bin = _find_extractor_by_cmd(winrar_cmd)\n        if winrar_bin is not None:\n            _extract_tar_with_winrar(winrar_bin, archive_path, output_dir, relative_to)\n            return\n        get_logger().warning(\n            'Neither 7-zip nor WinRAR were found. Falling back to Python extractor...')\n    elif current_platform == PlatformEnum.UNIX:\n        # NOTE: 7-zip isn't an option because it doesn't preserve file permissions\n        tar_bin = _find_extractor_by_cmd(extractors.get(ExtractorEnum.TAR))\n        if not tar_bin is None:\n            _extract_tar_with_tar(tar_bin, archive_path, output_dir, relative_to)\n            return\n    else:\n        # This is not a normal code path, so make it clear.\n        raise NotImplementedError(current_platform)\n    # Fallback to Python-based extractor on all platforms\n    _extract_tar_with_python(archive_path, output_dir, relative_to)\n\n\ndef extract_with_7z(archive_path, output_dir, relative_to, extractors=None):\n    \"\"\"\n    Extract archives with 7-zip into the output directory.\n    Only supports archives with one layer of unpacking, so compressed tar archives don't work.\n\n    archive_path is the pathlib.Path to the archive to unpack\n    output_dir is a pathlib.Path to the directory to unpack. It must already exist.\n\n    relative_to is a pathlib.Path for directories that should be stripped relative to the\n    root of the archive.\n    extractors is a dictionary of PlatformEnum to a command or path to the\n    extractor binary. Defaults to 'tar' for tar, and '_use_registry' for 7-Zip.\n    \"\"\"\n    # TODO: It would be nice to extend this to support arbitrary standard IO chaining of 7z","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/ungoogled-software/ungoogled-chromium/blob/f85e84a480e2e17c103de7013de94320f9a2ba39/utils/_extraction.py#L218-L254","documentation":"extract_tar_file only implements extractor dispatch for known platforms; when get_running_platform() returns something outside the handled set (macOS/Linux/Windows), the code path raises NotImplementedError(current_platform) to make the unsupported platform explicit instead of guessing.","triggerScenarios":"Running the library on an OS whose platform detection returns an unhandled value — unusual/unofficial platform strings, exotic platforms like FreeBSD/Alpine with odd detection, or monkeypatched/incorrect platform detection.","commonSituations":"Packaging for less common platforms (BSD, ChromeOS Linux env with odd uname), embedding the library on non-standard Python distributions where platform detection misfires.","solutions":["Run on a supported platform (Linux, macOS, Windows) or set the platform detection to a supported value","Call extract_with_7z / extract_with_tar-equivalent directly with an explicit extractor path (extractors={ExtractorEnum.TAR: '/usr/bin/tar'})","Patch/extend the platform dispatch in extract_tar_file for your platform","Fall back to Python's tarfile module in your own code"],"exampleFix":"// before\nextract_tar_file(archive, out)  # raises NotImplementedError on odd platform\n// after\nextract_with_7z('/usr/bin/7z', archive, out, extractors={ExtractorEnum.TAR: '/usr/bin/tar'})","handlingStrategy":"validation","validationCode":"from utils.platform import get_running_platform\nfrom utils.platform_enum import PlatformEnum\nSUPPORTED = {PlatformEnum.LINUX, PlatformEnum.MACOS, PlatformEnum.WINDOWS}\nif get_running_platform() not in SUPPORTED:\n    raise RuntimeError(f'unsupported platform: {get_running_platform()}')","typeGuard":null,"tryCatchPattern":"try:\n    extract_tar_file(archive, out, relative_to=rel)\nexcept NotImplementedError as e:\n    logger.error('platform %s unsupported for tar dispatch: %s', e, e)\n    raise","preventionTips":["Verify get_running_platform() value on target platforms before deploying","Test extraction on all target OSes in CI","Use explicit extractor configuration on exotic platforms","Keep platform detection code in sync with supported dispatch table"],"tags":["platform","unsupported-environment"],"backgroundTag":"unsupported-platform","analyzedSha":"f85e84a480e2e17c103de7013de94320f9a2ba39","analyzedAt":"2026-08-29T10:07:17.606Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}