instructure/canvas-lms · error

Unsupported submission type for turnitin integration: #

Error message

Unsupported submission type for turnitin integration: #{submission.submission_type}

What it means

Turnitinlib#submitPaper supports submitting only file attachments and online_text_entry submissions. Any other submission_type (e.g. online_url_entry, online_quiz, media) reaches the else branch and raises, because Turnitin's paper API has no mapped payload for it.

Solutions

  1. Only enable Turnitin for assignments whose allowed submission types are file upload / text entry
  2. Skip unsupported submissions in the calling job instead of submitting them
  3. Convert or flatten the submission content into a supported type before submission
  4. Add an explicit handler branch for the new submission type if Turnitin supports it

Example fix

// before
submission.submit_at plagiarism
// after
if %w[online_upload online_text_entry].include?(submission.submission_type)
  submission.submit_at(plagiarism)
else
  Rails.logger.warn("skipping turnitin for #{submission.submission_type}")
end
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = %w[online_upload online_text_entry].freeze
raise 'unsupported for turnitin' unless SUPPORTED.include?(submission.submission_type)

Type guard

def turnitin_submittable?(submission) = %w[online_upload online_text_entry].include?(submission.submission_type)

Try / catch

begin
  submission.submit_at(plagiarism_tool)
rescue RuntimeError => e
  raise unless e.message.start_with?('Unsupported submission type for turnitin')
  Rails.logger.warn("skipped: #{e.message}")
end

Prevention

When it happens

Trigger: Calling submit_at / submitPaper on a submission whose submission_type is neither an attachment-based type nor 'online_text_entry' (or the asset_string filter excludes every attachment and the text-entry branch doesn't match), so the else raise fires.

Common situations: Plagiarism platform jobs processing assignments that accept external-tool, quiz, or media recordings; enabling Turnitin on an assignment with unsupported online submission types; legacy data migrations touching old submission types.

Related errors


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

Appendix: source

Thrown at lib/turnitin.rb:200

      course = assignment.context
      opts = {
        post: true,
        utp: "1",
        user: student,
        course:,
        assignment:,
        tem: email(course)
      }
      responses = {}
      if submission.submission_type == "online_upload"
        attachments = submission.attachments.select { |a| a.turnitinable? && (asset_string.nil? || a.asset_string == asset_string) }
        attachments.each do |a|
          responses[a.asset_string] = sendRequest(:submit_paper, "2", { ptl: a.display_name, pdata: a.open, ptype: "2" }.merge!(opts))
        end
      elsif submission.submission_type == "online_text_entry" && (asset_string.nil? || submission.asset_string == asset_string)
        responses[submission.asset_string] = sendRequest(:submit_paper, "2", { ptl: assignment.title, pdata: submission.plaintext_body, ptype: "1" }.merge!(opts))
      else
        raise "Unsupported submission type for turnitin integration: #{submission.submission_type}"
      end

      responses.transform_values! do |res|
        res.success? ? { object_id: res.returned_object_id } : res.error_hash
      end

      responses
    end

    def generateReport(submission, asset_string)
      assignment = submission.assignment
      course = assignment.context
      object_id = submission.turnitin_data.dig(asset_string, :object_id)
      res = nil
      res = sendRequest(:generate_report, 2, oid: object_id, utp: "2", user: course, course:, assignment:) if object_id
      data = {}
      if res
        data[:similarity_score] = res.css("originalityscore").first.try(:content)

View on GitHub (pinned to 1c9f0bb801)