instructure/canvas-lms · error · PeerReview::SetTypeNotSupportedError

Set type ' ' is not supported. Supported types are

Error message

Set type '%{set_type}' is not supported. Supported types are: %{supported_types}

What it means

PeerReview::SetTypeNotSupportedError raised by validate_set_type_supported when set_type is not a key in the services hash. The message interpolates the offending set_type and the list of supported keys.

Solutions

  1. Use one of the supported set_type values listed in the message
  2. Check the services registry in the peer review service to see registered keys
  3. Upgrade/enable the plugin or service that provides the desired set type

Example fix

// before
service.call(set_type: 'groups', set_id: 7)   # not registered
// after
service.call(set_type: 'group', set_id: 7)    # matches services key
Defensive patterns

Strategy: validation

Validate before calling

supported = PeerReview::ServiceRegistry.services.keys
raise ArgumentError, "set_type must be one of #{supported.join(', ')}" unless supported.include?(params[:set_type])

Try / catch

begin
  service.call(set_type:)
rescue PeerReview::SetTypeNotSupportedError => e
  render json: { error: e.message }, status: :bad_request
end

Prevention

When it happens

Trigger: Calling a peer review service with set_type not registered in the services map — e.g. 'groups' when only 'group' is registered, a plugin providing a set type that is not enabled, or a typo/renamed key.

Common situations: Typo or singular/plural mismatch in set_type; newer/older versions where the service registry differs; disabling a plugin removed a supported type the client still sends.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at app/services/peer_review/validations.rb:227

  def validate_course_exists(course)
    raise PeerReview::CourseNotFoundError, I18n.t("Course does not exist") unless course.present?
  end

  def validate_student_ids_required(student_ids)
    if student_ids.nil? || student_ids == "" || student_ids.to_s.strip.empty? || (student_ids.is_a?(Array) && student_ids.empty?)
      raise PeerReview::StudentIdsRequiredError, I18n.t("Student ids are required")
    end
  end

  def validate_student_ids_in_course(student_ids)
    raise PeerReview::StudentIdsNotInCourseError, I18n.t("Student ids are not in course") if student_ids.blank?
  end

  def validate_set_type_supported(set_type, services)
    unless services.key?(set_type)
      supported_types = services.keys.join(", ")
      raise PeerReview::SetTypeNotSupportedError,
            I18n.t("Set type '%{set_type}' is not supported. Supported types are: %{supported_types}", set_type:, supported_types:)
    end
  end

  def validate_group_assignment_required(assignment)
    unless assignment.group_category_id
      raise PeerReview::GroupAssignmentRequiredError, I18n.t("Must be a group assignment to create group overrides")
    end
  end

  def validate_group_exists(group)
    raise PeerReview::GroupNotFoundError, I18n.t("Group does not exist") unless group.present?
  end

  def validate_adhoc_parent_override_exists(parent_override, student_ids)
    unless parent_override.present?
      raise PeerReview::ParentOverrideNotFoundError,
            I18n.t("Parent assignment ADHOC override not found for students %{student_ids}", student_ids: student_ids.join(", "))

View on GitHub (pinned to 1c9f0bb801)