ungoogled-software/ungoogled-chromium · error · ChildProcessError

7z command returned %s

Error message

7z command returned %s

What it means

extract_with_7z runs '7z x archive -aoa -ooutput_dir'; a non-zero exit code is logged and raised as ChildProcessError, indicating 7z failed to extract the archive.

Source

Thrown at utils/_extraction.py:276

    sevenzip_cmd = extractors.get(ExtractorEnum.SEVENZIP)
    if sevenzip_cmd == USE_REGISTRY:
        if not get_running_platform() == PlatformEnum.WINDOWS:
            get_logger().error('"%s" for 7-zip is only available on Windows', sevenzip_cmd)
            raise EnvironmentError()
        sevenzip_cmd = str(_find_7z_by_registry())
    sevenzip_bin = _find_extractor_by_cmd(sevenzip_cmd)

    if not relative_to is None and (output_dir / relative_to).exists():
        get_logger().error('Temporary unpacking directory already exists: %s',
                           output_dir / relative_to)
        raise FileExistsError()
    cmd = (sevenzip_bin, 'x', str(archive_path), '-aoa', f'-o{str(output_dir)}')
    get_logger().debug('7z command line: %s', ' '.join(cmd))

    result = subprocess.run(cmd, check=False)
    if result.returncode != 0:
        get_logger().error('7z command returned %s', result.returncode)
        raise ChildProcessError()

    _process_relative_to(output_dir, relative_to)


def extract_with_winrar(archive_path, output_dir, relative_to, extractors=None):
    """
    Extract archives with WinRAR into the output directory.
    Only supports archives with one layer of unpacking, so compressed tar archives don't work.

    archive_path is the pathlib.Path to the archive to unpack
    output_dir is a pathlib.Path to the directory to unpack. It must already exist.

    relative_to is a pathlib.Path for directories that should be stripped relative to the
    root of the archive.
    extractors is a dictionary of PlatformEnum to a command or path to the
    extractor binary. Defaults to 'tar' for tar, and '_use_registry' for WinRAR.
    """
    if extractors is None:

View on GitHub (pinned to f85e84a480)

Solutions

  1. Run the 7z command manually to see the real error output
  2. Check the archive integrity: 7z t archive
  3. Upgrade 7-zip or choose an extractor matching the archive format (extract_tar_file for .tar.*)
  4. Ensure any required password is available or decrypt the archive first
Defensive patterns

Strategy: try-catch

Validate before calling

import subprocess
probe = subprocess.run([sevenzip_bin, 't', str(archive_path)], capture_output=True)
if probe.returncode != 0:
    raise RuntimeError(f'7z integrity test failed: {probe.stderr!r}')

Try / catch

try:
    extract_with_7z(archive, out, relative_to=rel)
except ChildProcessError:
    logger.exception('7z extraction failed; verify archive and binary')
    raise

Prevention

When it happens

Trigger: Corrupt or unsupported archive (e.g. non-7z formats passed in, encrypted archives), missing/old 7z binary, disk full, or wrong archive_path (file not actually a 7z-capable format).

Common situations: Password-protected archives, p7zip classic lacking newer codecs, antivirus quarantine mid-extract on Windows, or pointing the extractor at a .tar.xz it cannot fully process in one step.

Related errors


AI-assisted analysis of ungoogled-software/ungoogled-chromium@f85e84a480 (2026-08-29). Data as JSON: /api/errors/814fb4b1b4c0807e. Report an issue: GitHub.