{"record":{"id":"3ae806001bdbd585","repo":"apache/superset","slug":"not-a-zip-file","errorCode":null,"errorMessage":"Not a ZIP file","messagePattern":"Not a ZIP file","errorType":"exception","errorClass":"IncorrectFormatError","httpStatus":422,"severity":"error","filePath":"superset/charts/api.py","lineNumber":1579,"sourceCode":"                  schema:\n                    type: object\n                    properties:\n                      message:\n                        type: string\n            400:\n              $ref: '#/components/responses/400'\n            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 not is_zipfile(upload):\n            raise IncorrectFormatError(\"Not a ZIP file\")\n        with ZipFile(upload) as bundle:\n            contents = get_contents_from_bundle(bundle)\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        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 = (","sourceCodeStart":1561,"sourceCodeEnd":1597,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/charts/api.py#L1561-L1597","documentation":"IncorrectFormatError('Not a ZIP file') raised by the chart import endpoint (POST /api/v1/chart/import/): the uploaded formData file is checked with zipfile.is_zipfile(), and anything without a valid ZIP magic/signature is rejected before the bundle is opened. Superset chart exports are distributed as ZIP archives containing YAML/JSON files, so this guard catches wrong file types at the boundary.","triggerScenarios":"Uploading a raw YAML/JSON export file, a .tar.gz, or a renamed non-ZIP file as formData to the import endpoint; uploading a truncated ZIP cut off by a proxy's body-size limit; multipart requests where the wrong part is picked because the field name differs and a text part is passed.","commonSituations":"Users exporting from older Superset versions or other tools that emit different archive formats; curl invocations where -F formData=@chart.yaml points at the inner file instead of the bundle; files corrupted in transit or by upload limits.","solutions":["Upload the ZIP bundle produced by the export endpoint (GET/POST /api/v1/chart/export/), not its unpacked contents.","If you have loose YAML files, zip them first: zip bundle.zip *.yaml (keeping the expected directory layout).","Verify locally before uploading: `file bundle.zip` should report 'Zip archive data' or `python -c \"from zipfile import is_zipfile; print(is_zipfile('bundle.zip'))\"`.","Check proxy/client body-size limits if uploads arrive truncated."],"exampleFix":"# before\ncurl -F 'formData=@chart.yaml' -H \"Authorization: Bearer $T\" \\\n  http://superset:8088/api/v1/chart/import/\n\n# after\nzip bundle.zip chart.yaml\ncurl -F 'formData=@bundle.zip' -H \"Authorization: Bearer $T\" \\\n  http://superset:8088/api/v1/chart/import/","handlingStrategy":"validation","validationCode":"from zipfile import is_zipfile\n\nwith open(path, \"rb\") as f:\n    if not is_zipfile(f):\n        raise SystemExit(f\"{path} is not a ZIP archive; export bundles must be zipped\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always consume the export endpoint's response bytes directly as the import payload instead of re-packaging by hand.","Check uploads with `file` or is_zipfile before sending to the API."],"tags":["rest-api","import-export","zip","charts","validation"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}