{"record":{"id":"31f8e457d9cffbed","repo":"apache/superset","slug":"no-valid-import-files-were-found-31f8e4","errorCode":null,"errorMessage":"No valid import files were found","messagePattern":"No valid import files were found","errorType":"exception","errorClass":"NoValidFilesFoundError","httpStatus":400,"severity":"error","filePath":"superset/dashboards/api.py","lineNumber":2426,"sourceCode":"            401:\n              $ref: '#/components/responses/401'\n            422:\n              $ref: '#/components/responses/422'\n            500:\n              $ref: '#/components/responses/500'\n        \"\"\"\n        upload = request.files.get(\"formData\")\n        if not upload:\n            return self.response_400()\n        if is_zipfile(upload):\n            with ZipFile(upload) as bundle:\n                contents = get_contents_from_bundle(bundle)\n        else:\n            upload.seek(0)\n            contents = {upload.filename: upload.read()}\n\n        if not contents:\n            raise NoValidFilesFoundError()\n\n        passwords = (\n            json.loads(request.form[\"passwords\"])\n            if \"passwords\" in request.form\n            else None\n        )\n        overwrite = request.form.get(\"overwrite\") == \"true\"\n        overwrite_all = parse_boolean_string(request.form.get(\"overwrite_all\", \"false\"))\n\n        ssh_tunnel_passwords = (\n            json.loads(request.form[\"ssh_tunnel_passwords\"])\n            if \"ssh_tunnel_passwords\" in request.form\n            else None\n        )\n        ssh_tunnel_private_keys = (\n            json.loads(request.form[\"ssh_tunnel_private_keys\"])\n            if \"ssh_tunnel_private_keys\" in request.form\n            else None","sourceCodeStart":2408,"sourceCodeEnd":2444,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/dashboards/api.py#L2408-L2444","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-export the dashboard from a working Superset instance (Settings > Export) and upload that exact ZIP unmodified.","Inspect the ZIP locally (unzip -l) and confirm it contains the expected YAML/JSON export files at the top level.","Verify the multipart field name is exactly 'formData' and the file actually reached the server (check REQUEST_CONTENT_MAX_SIZE / proxy body limits).","If hand-crafting a bundle, match the structure produced by superset export command (dashboard.yaml/database.yaml etc.)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import zipfile\nfrom pathlib import Path\n\ndef valid_import_bundle(path: Path) -> bool:\n    if not zipfile.is_zipfile(path):\n        return False\n    with zipfile.ZipFile(path) as zf:\n        names = zf.namelist()\n    return len(names) > 0 and any(n.endswith(\".yaml\") or n.endswith(\".json\") for n in names)","typeGuard":null,"tryCatchPattern":"from superset.commands.import_exceptions import NoValidFilesFoundError\ntry:\n    client.post(\"/api/v1/dashboard/import/\", files={\"formData\": bundle})\nexcept NoValidFilesFoundError:\n    raise SystemExit(\"bundle empty or wrong layout — re-export from Superset\")","preventionTips":["Always upload the untouched ZIP produced by Superset export.","Pre-flight check the archive with zipfile.ZipFile(...).namelist().","Use the multipart field name 'formData' exactly."],"tags":["import","dashboard","zip","upload"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}