instructure/canvas-lms · warning

[A11Y Scan] Skipped resource #

Error message

[A11Y Scan] Skipped resource #{@resource&.id} due to size limit.

What it means

Accessibility::ResourceScannerService#handle_size_limit_failure marks an AccessibilityScan as failed with an error_message and logs this warning when the resource's content exceeds the scanner's size limit. The resource is skipped (scan failed) rather than scanned, to protect the scanner from oversized payloads.

Solutions

  1. Increase the scanner's size limit configuration if the resources are legitimately scannable
  2. Reduce the resource content size (trim embedded media/base64 blobs) and re-run the scan
  3. Chunk or preprocess oversized content before scanning so it fits under the cap
  4. Treat the failed scan as expected — surface the workflow_state 'failed' + error_message to users so they know the resource was skipped

Example fix

// before
scan.update(workflow_state: "failed", error_message:)
log_to_datadog(scan)
Rails.logger.warn("[A11Y Scan] Skipped resource #{@resource&.id} due to size limit.")

// after: check size before scheduling the scan
def scan_resource
  return log_size_skip if content.to_s.bytesize > MAX_SCAN_BYTES
  # ... normal scan path
end
Defensive patterns

Strategy: validation

Validate before calling

if content.to_s.bytesize > MAX_SCAN_BYTES
  Rails.logger.warn("resource #{resource.id} exceeds scan size limit")
else
  ResourceScannerService.new(resource).scan_resource
end

Type guard

def scannable?(resource)
  resource.present? && resource_content(resource).to_s.bytesize <= MAX_SCAN_BYTES
end

Prevention

When it happens

Trigger: scan_resource encounters a resource (assignment/page/attachment content) whose rendered content or body exceeds the configured maximum scan size, triggering handle_size_limit_failure which fails the scan and logs the skip.

Common situations: Users upload extremely large HTML pages, assignments with huge embedded content, or attachments over the scanner size cap; environments with low size-limit configuration scanning large courses.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/07f571ad1565ba28. Report an issue: GitHub.

Appendix: source

Thrown at app/services/accessibility/resource_scanner_service.rb:206

  def handle_size_limit_failure(scan)
    error_message = case @resource
                    when Attachment
                      I18n.t(
                        "This file is too large to check. PDF attachments must not be greater than %{size} MB.",
                        { size: MAX_PDF_SIZE / 1.megabyte }
                      )
                    else
                      I18n.t(
                        "This content is too large to check. HTML body must not be greater than %{size} KB.",
                        { size: MAX_HTML_SIZE / 1.kilobyte }
                      )
                    end
    scan.update(
      workflow_state: "failed",
      error_message:
    )
    log_to_datadog(scan)
    Rails.logger.warn("[A11Y Scan] Skipped resource #{@resource&.id} due to size limit.")
  end

  def resource_workflow_state
    # Check if resource implements the new interface
    if @resource.respond_to?(:scannable_workflow_state)
      @resource.scannable_workflow_state
    else
      case @resource
      when WikiPage, DiscussionTopic, Announcement
        @resource.active? ? "published" : "unpublished"
      when Assignment
        @resource.published? ? "published" : "unpublished"
      when Attachment
        @resource.processed? ? "published" : "unpublished"
      else
        resource_name = @resource.respond_to?(:resource_class_name) ? @resource.resource_class_name : @resource.class.name
        raise ArgumentError, "Unsupported resource type: #{resource_name}"
      end

View on GitHub (pinned to 1c9f0bb801)