{"record":{"id":"a7f138f91d962ff7","repo":"zylon-ai/private-gpt","slug":"zpgt-ingest-invalid-file-size-error","errorCode":"zpgt.ingest.invalid_file_size.error","errorMessage":"zpgt.ingest.invalid_file_size.error","messagePattern":"zpgt\\.ingest\\.invalid_file_size\\.error","errorType":"error_code","errorClass":"InvalidFileError","httpStatus":400,"severity":"error","filePath":"private_gpt/components/ingest/parse_component.py","lineNumber":185,"sourceCode":"\n    def _get_file_info(\n        self,\n        file_data: Path,\n        file_metadata: dict[str, Any] | None,\n        progress: NotifyProtocol | None = None,\n    ) -> FileInfo:\n        file_name = get_file_name(file_metadata) or file_data.name\n        return get_file_info(file_data, file_name=file_name, progress=progress)\n\n    def _validate_file(\n        self,\n        file_info: FileInfo,\n        progress: NotifyProtocol,\n    ) -> tuple[list[str], list[str]]:\n        errors, warnings = IngestionHelper.validate_file_info(file_info)\n        if errors:\n            logger.info(\"Validation errors: %s\", errors)\n            raise InvalidFileError(errors=errors, warnings=warnings)\n        if warnings:\n            logger.info(\"Validation warnings: %s\", warnings)\n            progress(percentage=100, warnings=warnings)\n        return errors, warnings\n\n    def _load_data(\n        self,\n        file_info: FileInfo,\n        file_metadata: dict[str, Any] | None,\n        notification: NotifyProtocol | None = None,\n        warnings: list[str] | None = None,\n        reader_name: str | None = None,\n    ) -> list[BaseNode]:\n        return asyncio.run(\n            self._aload_data(\n                file_info=file_info,\n                file_metadata=file_metadata,\n                notification=notification,","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/ingest/parse_component.py#L167-L203","documentation":"InvalidFileError raised during _validate_file when IngestionHelper.validate_file_info returns a non-empty errors list — most commonly file-size validation failures (zpgt.ingest.invalid_file_size.error). The validation errors list is included in the exception so callers can see every failed rule.","triggerScenarios":"Calling validate_file / ingest with a file whose size is outside the configured min/max bounds, or otherwise fails validate_file_info rules (bad extension, etc.). The error propagates before any parsing begins.","commonSituations":"Uploading a document larger than the configured maximum ingest size; uploading a 0-byte file below the minimum; changing size limits in config after files were staged; proxy body-size limits producing tiny truncated files.","solutions":["Read the errors list on the raised InvalidFileError — it names the exact rule(s) that failed (e.g. file too large).","Compress or split the document to satisfy the configured size limit, or raise the limit in the ingestion config.","For 0-byte files, verify the upload actually transferred the bytes (check Content-Length, proxy limits like nginx client_max_body_size).","Confirm the extension is in the allowed list before upload."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"size = os.path.getsize(path)\nif size > settings.ingestion.max_file_size or size < settings.ingestion.min_file_size:\n    raise ValueError(f'file size {size} outside allowed bounds')","typeGuard":null,"tryCatchPattern":"try:\n    file_info, errors, warnings = ingest.validate_file(path, metadata)\nexcept InvalidFileError as e:\n    return api_error(422, details=e.errors)  # list of failed validation rules","preventionTips":["Mirror the server's size limits in the upload UI so users get feedback before transfer.","Read e.errors on InvalidFileError — it enumerates every failed rule, not just the first."],"tags":["ingestion","validation","file-size","upload"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}