{"record":{"id":"781966f510aec8c4","repo":"gitlabhq/gitlabhq","slug":"file-size-size-exceeds-limit-of-limit","errorCode":null,"errorMessage":"File size %{size} exceeds limit of %{limit}","messagePattern":"File size %(.+?) exceeds limit of %(.+?)","errorType":"exception","errorClass":"Import::BulkImports::FileDownloadStrategy::ServiceError","httpStatus":null,"severity":"error","filePath":"app/services/import/bulk_imports/file_download_strategy.rb","lineNumber":27,"sourceCode":"\n      def download_file(filepath)\n        Gitlab::PathTraversal.check_path_traversal!(filepath)\n\n        perform_download(filepath)\n\n        validate_symlink(filepath)\n      end\n\n      def validate!\n        raise Gitlab::AbstractMethodError\n      end\n\n      def log_and_raise_error(message)\n        log_params = { message: message }\n        log_params.merge!(log_error_params)\n        logger.warn(log_params)\n\n        raise ServiceError, message\n      end\n\n      private\n\n      def perform_download(_filepath)\n        raise Gitlab::AbstractMethodError\n      end\n\n      def file_size_limit\n        raise Gitlab::AbstractMethodError\n      end\n\n      def validate_symlink(filepath)\n        return unless Gitlab::Utils::FileInfo.linked?(filepath)\n\n        File.delete(filepath)\n        log_and_raise_error('Invalid downloaded file')\n      end","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/gitlabhq/gitlabhq/blob/55ee20384a1f55cb0e362dee1d07149613b1b9bf/app/services/import/bulk_imports/file_download_strategy.rb#L9-L45","documentation":"Raised via Import::BulkImports::FileDownloadStrategy#log_and_raise_error from validate_size! (app/services/import/bulk_imports/file_download_strategy.rb:50) as ServiceError when a downloaded relation/export file's size exceeds the strategy's file_size_limit (a limit of 0 means unlimited). The message is formatted with ActiveSupport::NumberHelper to human-readable units, e.g. 'File size 2.5 GB exceeds limit of 1 GB'. Like the symlink case it logs a warning through BulkImports::Logger before raising.","triggerScenarios":"A bulk import / direct transfer downloads an export or relation archive whose byte size is larger than the configured limit enforced by the concrete strategy (validate_size! is called with the Content-Length or written size during perform_download). Typical triggers: very large groups whose relation exports grew past the instance's import size cap, or limits lowered after previous imports succeeded.","commonSituations":"Enterprise migrations of monolithic groups; administrators tightening max import size settings; export bloat from large issues/MR diffs; a different setting applying on the destination instance than the source.","solutions":["Identify the limit from the error text (the %{limit} value) and the offending file size, then raise the corresponding import/export size limit setting on the destination instance (e.g. group/project import size limits or Max import size in Application settings).","Reduce the payload: split the migration into smaller top-level groups or exclude heavy relations, so each archive stays under the cap.","Re-run the bulk import after the change; previously oversized downloads re-attempt cleanly.","If the limit is intentionally strict, filter out the oversized entity and report it rather than retrying."],"exampleFix":"# before — destination limit 1 GB, export is 2.5 GB\nstrategy.download_file(tmp_path)\n# => ServiceError: File size 2.5 GB exceeds limit of 1 GB\n\n# after — raise the instance import cap, then re-import\n# (Admin Area → Settings → General → Account and limit → Maximum import size, or)\n# rails console:\nApplicationSetting.first.update!(max_import_size: 10240) # MiB\nstrategy.download_file(tmp_path)","handlingStrategy":"try-catch","validationCode":"# If the size is knowable beforehand, compare against the same limit\nlimit = strategy.file_size_limit\nif limit > 0 && remote_size > limit\n  # split the export or raise the limit before downloading\nend","typeGuard":null,"tryCatchPattern":"begin\n  strategy.download_file(filepath)\nrescue Import::BulkImports::FileDownloadStrategy::ServiceError => e\n  # parse 'File size X exceeds limit of Y' — raise the instance import\n  # size limit or split the migration into smaller groups, then retry\nend","preventionTips":["Set Max import size on the destination with headroom over the largest group's relation export.","Pre-compute export sizes on the source instance before planning a migration.","Split very large top-level groups into per-subgroup imports to stay under per-file caps."],"tags":["gitlab","bulk-import","file-size-limit","import-export","configuration"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"55ee20384a1f55cb0e362dee1d07149613b1b9bf","analyzedAt":"2026-08-21T14:22:27.782Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}