langflow-ai/langflow · error · ValueError
ZIP contains {len(json_entries)} JSON entries, exceeding the
Error message
ZIP contains {len(json_entries)} JSON entries, exceeding the limit of {MAX_ZIP_ENTRIES} What it means
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.
Source
Thrown at src/backend/base/langflow/api/utils/zip_utils.py:45
"""Synchronous helper that performs all blocking ZIP I/O.
Raises:
ValueError: If the ZIP is corrupt or contains more than MAX_ZIP_ENTRIES JSON files.
"""
result = _ZipExtractionResult()
try:
zf = zipfile.ZipFile(io.BytesIO(contents), "r")
except zipfile.BadZipFile as exc:
msg = f"Uploaded file is not a valid ZIP archive: {exc}"
raise ValueError(msg) from exc
with zf:
json_entries = [info for info in zf.infolist() if info.filename.lower().endswith(".json")]
if len(json_entries) > MAX_ZIP_ENTRIES:
msg = f"ZIP contains {len(json_entries)} JSON entries, exceeding the limit of {MAX_ZIP_ENTRIES}"
raise ValueError(msg)
for info in json_entries:
if info.file_size > MAX_ENTRY_UNCOMPRESSED_BYTES:
result.warnings.append(
f"Skipping ZIP entry '{info.filename}': uncompressed size "
f"{info.file_size} exceeds limit of {MAX_ENTRY_UNCOMPRESSED_BYTES} bytes"
)
continue
try:
raw = zf.read(info.filename)
if len(raw) > MAX_ENTRY_UNCOMPRESSED_BYTES:
result.warnings.append(
f"Skipping ZIP entry '{info.filename}': actual size "
f"{len(raw)} exceeds limit of {MAX_ENTRY_UNCOMPRESSED_BYTES} bytes"
)
continue
result.flows.append(orjson.loads(raw))
except orjson.JSONDecodeError:View on GitHub (pinned to 976ec789d2)
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
Example fix
# before zip -r all.zip workspace/ # includes package.json, configs, 1000+ files # after find workspace -name 'flow*.json' | head -n $MAX_ZIP_ENTRIES | zip batch1.zip -@
Defensive patterns
Strategy: validation
Validate before calling
import zipfile
from langflow.api.utils.zip_utils import MAX_ZIP_ENTRIES # or re-declare the same constant
def zip_within_limit(path: str) -> bool:
with zipfile.ZipFile(path) as zf:
n = sum(i.filename.lower().endswith(".json") for i in zf.infolist())
return n <= MAX_ZIP_ENTRIES Try / catch
try:
import_flows(zip_bytes)
except ValueError as e:
if "exceeding the limit" in str(e):
for batch in split_zip(zip_bytes, MAX_ZIP_ENTRIES):
import_flows(batch)
else:
raise Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Uploaded file is not a valid ZIP archive: {exc}
- Too many files detected (${droppedFiles.length}). This likel
- errors.tooManyFiles
- The '{provider}' components moved to the 'lfx-bundles' distr
- Could not import {attr_name!r} from {__name__!r}: {e}
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/f3314790881621bd.
Report an issue: GitHub.