apache/superset · error · NoValidFilesFoundError

No valid import files were found

Error message

No valid import files were found

What it means

Raised by the dashboard import endpoint (POST /api/v1/dashboard/import/) when the upload contains no usable files. The endpoint accepts either a ZIP bundle or a single file; if neither path yields any contents (empty ZIP, or bundle from which get_contents_from_bundle extracts nothing), NoValidFilesFoundError is raised before any import work starts.

Source

Thrown at superset/dashboards/api.py:2426

            401:
              $ref: '#/components/responses/401'
            422:
              $ref: '#/components/responses/422'
            500:
              $ref: '#/components/responses/500'
        """
        upload = request.files.get("formData")
        if not upload:
            return self.response_400()
        if is_zipfile(upload):
            with ZipFile(upload) as bundle:
                contents = get_contents_from_bundle(bundle)
        else:
            upload.seek(0)
            contents = {upload.filename: upload.read()}

        if not contents:
            raise NoValidFilesFoundError()

        passwords = (
            json.loads(request.form["passwords"])
            if "passwords" in request.form
            else None
        )
        overwrite = request.form.get("overwrite") == "true"
        overwrite_all = parse_boolean_string(request.form.get("overwrite_all", "false"))

        ssh_tunnel_passwords = (
            json.loads(request.form["ssh_tunnel_passwords"])
            if "ssh_tunnel_passwords" in request.form
            else None
        )
        ssh_tunnel_private_keys = (
            json.loads(request.form["ssh_tunnel_private_keys"])
            if "ssh_tunnel_private_keys" in request.form
            else None

View on GitHub (pinned to f4587218dd)

Solutions

  1. Re-export the dashboard from a working Superset instance (Settings > Export) and upload that exact ZIP unmodified.
  2. Inspect the ZIP locally (unzip -l) and confirm it contains the expected YAML/JSON export files at the top level.
  3. Verify the multipart field name is exactly 'formData' and the file actually reached the server (check REQUEST_CONTENT_MAX_SIZE / proxy body limits).
  4. If hand-crafting a bundle, match the structure produced by superset export command (dashboard.yaml/database.yaml etc.).
Defensive patterns

Strategy: validation

Validate before calling

import zipfile
from pathlib import Path

def valid_import_bundle(path: Path) -> bool:
    if not zipfile.is_zipfile(path):
        return False
    with zipfile.ZipFile(path) as zf:
        names = zf.namelist()
    return len(names) > 0 and any(n.endswith(".yaml") or n.endswith(".json") for n in names)

Try / catch

from superset.commands.import_exceptions import NoValidFilesFoundError
try:
    client.post("/api/v1/dashboard/import/", files={"formData": bundle})
except NoValidFilesFoundError:
    raise SystemExit("bundle empty or wrong layout — re-export from Superset")

Prevention

When it happens

Trigger: POST /api/v1/dashboard/import/ with formData that is an empty ZIP, a ZIP whose entries are all filtered out by get_contents_from_bundle (e.g. wrong file names/structure for a Superset export), or a zero-byte upload.

Common situations: Exporting a ZIP with a different tool (zip of the folder rather than the Superset export bundle), truncated upload due to request size limits, importing a bundle from an incompatible Superset version whose file layout differs.

Related errors


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