apache/superset · error · DatabaseUploadFailed

str(ex)

Error message

str(ex)

What it means

DatabaseUploadFailed whose message is the raw string of a SupersetException raised by superset.utils.zip.check_is_safe_zip inside ColumnarReader._yield_files. This is the decompression-bomb guard: before reading any entry, Superset checks the ZIP's declared total uncompressed size and file count against configured limits, and rejects oversized or entry-count-excessive archives. The user-visible message is whatever the guard reported (e.g. archive exceeds maximum allowed size).

Source

Thrown at superset/commands/database/uploaders/columnar_reader.py:99

        :param file: The file to yield files from.
        :return: A generator that yields files.
        """
        file_suffix = Path(file.filename).suffix
        if not file_suffix:
            raise DatabaseUploadFailed(_("Unexpected no file extension found"))
        file_suffix = file_suffix[1:]  # remove the dot
        if file_suffix == "zip":
            if not is_zipfile(file):
                raise DatabaseUploadFailed(_("Not a valid ZIP file"))
            try:
                with ZipFile(file) as zip_file:
                    # guard against decompression bombs before reading entries,
                    # mirroring the importer path
                    try:
                        check_is_safe_zip(zip_file)
                    except SupersetException as ex:
                        raise DatabaseUploadFailed(str(ex)) from ex
                    # check if all file types are of the same extension
                    file_suffixes = {Path(name).suffix for name in zip_file.namelist()}
                    if len(file_suffixes) > 1:
                        raise DatabaseUploadFailed(
                            _("ZIP file contains multiple file types")
                        )
                    for filename in zip_file.namelist():
                        with zip_file.open(filename) as file_in_zip:
                            yield BytesIO(file_in_zip.read())
            except BadZipfile as ex:
                raise DatabaseUploadFailed(_("Not a valid ZIP file")) from ex
        else:
            yield file

    def file_to_dataframe(self, file: FileStorage) -> pd.DataFrame:
        """
        Read Columnar file into a DataFrame

View on GitHub (pinned to f4587218dd)

Solutions

  1. Re-package the data as a single uncompressed .parquet upload (skip the ZIP) or split it into smaller archives below the limit
  2. Check the server's zip safety limits configuration and confirm the archive's declared uncompressed sizes (unzip -l) fall under them
  3. Regenerate the ZIP with a standard tool to fix bogus size metadata
  4. If the limit is intentionally too low for your workload, raise it in superset_config.py after reviewing memory capacity

Example fix

# inspect declared uncompressed sizes
unzip -l data.zip   # compare 'uncompressed' column vs configured limit
# split if too large
zip data_part1.zip data_0.parquet; zip data_part2.zip data_1.parquet
Defensive patterns

Strategy: validation

Validate before calling

import zipfile

def zip_within_limits(fh, max_uncompressed: int, max_entries: int) -> bool:
    fh.seek(0)
    with zipfile.ZipFile(fh) as z:
        total = sum(i.file_size for i in z.infolist())
        return len(z.namelist()) <= max_entries and total <= max_uncompressed

Try / catch

try:
    reader.file_to_dataframe(file)
except DatabaseUploadFailed as ex:
    if 'size' in str(ex).lower() or 'entries' in str(ex).lower():
        # zip safety guard: split archive and retry with smaller parts
        ...

Prevention

When it happens

Trigger: Uploading a .zip whose entries declare a combined uncompressed size above the configured limit (ZIP_BOMB_UNCOMPRESSED_SIZE_LIMIT style config) or with more entries than allowed; small compressed files that expand to very large Parquet buffers trigger it even when the .zip itself is small.

Common situations: Legitimately large data exports zipped for transfer; archives produced by tools that store files uncompressed but pad sizes; malicious or corrupted central-directory size fields; changing Superset config to lower limits.

Related errors


AI-assisted analysis of apache/superset@f4587218dd (2026-08-14). Data as JSON: /api/errors/eeef8f259a3f4308. Report an issue: GitHub.