{"record":{"id":"265b63f0d12e98e6","repo":"langflow-ai/langflow","slug":"the-file-size-is-too-large-please-select-a-file-s","errorCode":null,"errorMessage":"The file size is too large. Please select a file smaller than {{maxSizeMB}}.","messagePattern":"The file size is too large\\. Please select a file smaller than (.+?)\\}\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"src/frontend/src/shared/hooks/use-file-size-validator.ts","lineNumber":11,"sourceCode":"import { useTranslation } from \"react-i18next\";\nimport { useUtilityStore } from \"@/stores/utilityStore\";\nimport { formatFileSize } from \"@/utils/stringManipulation\";\n\nconst useFileSizeValidator = () => {\n  const { t } = useTranslation();\n  const maxFileSizeUpload = useUtilityStore((state) => state.maxFileSizeUpload);\n\n  const validateFileSize = (file) => {\n    if (file.size > maxFileSizeUpload) {\n      throw new Error(\n        t(\"errors.fileTooLarge\", {\n          maxSizeMB: formatFileSize(maxFileSizeUpload),\n        }),\n      );\n    }\n    return true;\n  };\n\n  return { validateFileSize };\n};\n\nexport default useFileSizeValidator;\n","sourceCodeStart":1,"sourceCodeEnd":24,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/frontend/src/shared/hooks/use-file-size-validator.ts#L1-L24","documentation":"Thrown by the useFileSizeValidator hook when a selected file's byte size exceeds maxFileSizeUpload from the utility store (populated from the backend's LANGFLOW_MAX_FILE_SIZE_UPLOAD config). The message is the i18n key errors.fileTooLarge with the limit interpolated via formatFileSize, so users see the concrete limit (e.g. 'smaller than 100 MB').","triggerScenarios":"Any file-picker or drag-drop upload path that calls validateFileSize(file) with file.size > maxFileSizeUpload — e.g. attaching a 500 MB CSV when the server caps uploads at 100 MB.","commonSituations":"Default server limit is far smaller than the user's file; admins who raised LANGFLOW_MAX_FILE_UPLOAD on the backend but the frontend store still holds the old value (stale config fetch); reverse proxies (nginx client_max_body_size) rejecting before this check.","solutions":["Select a file under the displayed limit, or compress/split the file first","Raise the server limit: set LANGFLOW_MAX_FILE_SIZE_UPLOAD (bytes) in the backend env and restart, so the fetched config raises the frontend limit too","If the limit looks wrong in the UI, hard-refresh so the utility store re-fetches /config before concluding the backend change failed","For very large datasets, upload to object storage and reference by URL instead of the file manager"],"exampleFix":"# before (default limit too small for user data)\n# .env\nLANGFLOW_MAX_FILE_SIZE_UPLOAD=104857600\n\n# after\nLANGFLOW_MAX_FILE_SIZE_UPLOAD=1048576000  # 1 GB; also raise proxy body limits","handlingStrategy":"validation","validationCode":"const { validateFileSize } = useFileSizeValidator();\nconst safeFiles = files.filter((f) => f.size <= maxFileSizeUpload);\n// or check explicitly before upload:\nif (file.size > maxFileSizeUpload) skipAndNotify(file);","typeGuard":null,"tryCatchPattern":"try {\n  validateFileSize(file);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"file size\")) {\n    showFileSizeWarning(file.name); // skip file, continue batch\n  } else throw e;\n}","preventionTips":["Read maxFileSizeUpload from /config on app start and show it next to upload controls","Filter oversized files before batching uploads so one bad file doesn't abort the batch","Keep LANGFLOW_MAX_FILE_SIZE_UPLOAD aligned with proxy body-size limits"],"tags":["frontend","file-upload","configuration","i18n"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}