{"record":{"id":"f3314790881621bd","repo":"langflow-ai/langflow","slug":"zip-contains-len-json-entries-json-entries-exc","errorCode":null,"errorMessage":"ZIP contains {len(json_entries)} JSON entries, exceeding the limit of {MAX_ZIP_ENTRIES}","messagePattern":"ZIP contains (.+?) JSON entries, exceeding the limit of (.+?)","errorType":"http","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"src/backend/base/langflow/api/utils/zip_utils.py","lineNumber":45,"sourceCode":"    \"\"\"Synchronous helper that performs all blocking ZIP I/O.\n\n    Raises:\n        ValueError: If the ZIP is corrupt or contains more than MAX_ZIP_ENTRIES JSON files.\n    \"\"\"\n    result = _ZipExtractionResult()\n\n    try:\n        zf = zipfile.ZipFile(io.BytesIO(contents), \"r\")\n    except zipfile.BadZipFile as exc:\n        msg = f\"Uploaded file is not a valid ZIP archive: {exc}\"\n        raise ValueError(msg) from exc\n\n    with zf:\n        json_entries = [info for info in zf.infolist() if info.filename.lower().endswith(\".json\")]\n\n        if len(json_entries) > MAX_ZIP_ENTRIES:\n            msg = f\"ZIP contains {len(json_entries)} JSON entries, exceeding the limit of {MAX_ZIP_ENTRIES}\"\n            raise ValueError(msg)\n\n        for info in json_entries:\n            if info.file_size > MAX_ENTRY_UNCOMPRESSED_BYTES:\n                result.warnings.append(\n                    f\"Skipping ZIP entry '{info.filename}': uncompressed size \"\n                    f\"{info.file_size} exceeds limit of {MAX_ENTRY_UNCOMPRESSED_BYTES} bytes\"\n                )\n                continue\n            try:\n                raw = zf.read(info.filename)\n                if len(raw) > MAX_ENTRY_UNCOMPRESSED_BYTES:\n                    result.warnings.append(\n                        f\"Skipping ZIP entry '{info.filename}': actual size \"\n                        f\"{len(raw)} exceeds limit of {MAX_ENTRY_UNCOMPRESSED_BYTES} bytes\"\n                    )\n                    continue\n                result.flows.append(orjson.loads(raw))\n            except orjson.JSONDecodeError:","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/utils/zip_utils.py#L27-L63","documentation":"Raised by _extract_flows_sync when the uploaded ZIP contains more .json entries than MAX_ZIP_ENTRIES. This is a deliberate resource guard: parsing unbounded numbers of flow JSONs could exhaust memory/CPU, so bulk import is capped. The ValueError propagates to a 4xx response naming the actual count and the limit.","triggerScenarios":"Uploading a bulk-export ZIP that bundles more JSON flow files than the MAX_ZIP_ENTRIES constant allows (check zip_utils.py for the current value).","commonSituations":"Migrating a large workspace or exporting an entire org's flows into one archive; zipping a directory that includes unrelated .json files (package.json, lock files, config dumps) that all count toward the entry limit.","solutions":["Split the archive into several ZIPs, each under the MAX_ZIP_ENTRIES limit, and upload them separately","Remove non-flow .json files from the ZIP (package.json, tsconfig, etc.) so only real flow files count","Raise MAX_ZIP_ENTRIES only if you control the deployment and accept the resource cost"],"exampleFix":"# before\nzip -r all.zip workspace/   # includes package.json, configs, 1000+ files\n# after\nfind workspace -name 'flow*.json' | head -n $MAX_ZIP_ENTRIES | zip batch1.zip -@","handlingStrategy":"validation","validationCode":"import zipfile\nfrom langflow.api.utils.zip_utils import MAX_ZIP_ENTRIES  # or re-declare the same constant\n\ndef zip_within_limit(path: str) -> bool:\n    with zipfile.ZipFile(path) as zf:\n        n = sum(i.filename.lower().endswith(\".json\") for i in zf.infolist())\n    return n <= MAX_ZIP_ENTRIES","typeGuard":null,"tryCatchPattern":"try:\n    import_flows(zip_bytes)\nexcept ValueError as e:\n    if \"exceeding the limit\" in str(e):\n        for batch in split_zip(zip_bytes, MAX_ZIP_ENTRIES):\n            import_flows(batch)\n    else:\n        raise","preventionTips":["Strip non-flow .json files (package.json etc.) from export archives","Chunk bulk migrations into batches below the entry cap","Pin the constant MAX_ZIP_ENTRIES from the deployed server version, not a guess"],"tags":["zip","upload","limit","import"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}