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

set_type of '# ' not supported. Supported types: #

Error message

set_type of '#{key}' not supported. Supported types: #{services.keys}

What it means

After resolving set_type, DateOverrideCommonService selects the handler via services.fetch(set_type); when the requested set_type is not a registered key it raises SetTypeNotSupportedError, embedding the bad key and the list of supported types. This guards against dispatching date-override handling to a service class that doesn't exist for that override kind.

Solutions

  1. Use one of the supported set_type values exactly as listed in the error message (keys of services).
  2. If a new legitimate set type must be supported, register its service in the `services` hash of Checkpoints::DateOverrideCommonService.
  3. Normalize/validate set_type (upcasing, whitelist check) at the API boundary before calling the service.

Example fix

// before
overrides: [{ set_type: 'adhoc', ... }]
// after
overrides: [{ set_type: 'ADHOC', ... }]
Defensive patterns

Strategy: validation

Validate before calling

supported = Checkpoints::DateOverrideCommonService.new(checkpoint:).send(:services).keys
raise ArgumentError, "bad set_type #{t}" unless supported.include?(t)

Type guard

VALID_SET_TYPES = %w[ADHOC CourseSection Group].freeze
def supported_set_type?(t)
  VALID_SET_TYPES.include?(t.to_s)
end

Try / catch

begin
  service.call(checkpoint:, overrides:)
rescue Checkpoints::SetTypeNotSupportedError => e
  Rails.logger.error(e.message)
  render json: { error: e.message }, status: :unprocessable_entity
end

Prevention

When it happens

Trigger: Passing an override whose set_type is not one of the registered keys in `services` (e.g. a typo like 'adhoc' lowercase, or an unsupported type such as 'Noop'/'Group' if unregistered). Fired per-override inside the loop.

Common situations: Typo/case mismatch in set_type strings ('adhoc' vs 'ADHOC'); new AssignmentOverride set types introduced in Canvas but not registered in this service's services map; API clients sending arbitrary strings for set_type.

Related errors


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

Appendix: source

Thrown at app/services/checkpoints/date_override_common_service.rb:36

# with this program. If not, see <http://www.gnu.org/licenses/>.

class Checkpoints::DateOverrideCommonService < ApplicationService
  def initialize(checkpoint:, overrides:)
    super()
    @checkpoint = checkpoint
    @overrides = overrides
  end

  def call
    @overrides.each do |override|
      set_type = override.fetch(:set_type, nil)

      # If set_type is nil and override has an id, fetch the set_type from the checkpoint
      set_type = @checkpoint.assignment_overrides.find(override[:id]).set_type if set_type.nil? && override[:id]

      raise Checkpoints::SetTypeRequiredError, "set_type is required, but was not provided" if set_type.nil?

      service = services.fetch(set_type) { |key| raise Checkpoints::SetTypeNotSupportedError, "set_type of '#{key}' not supported. Supported types: #{services.keys}" }
      service.call(checkpoint: @checkpoint, override:)
    end
  end

  private

  def services
    {}
  end
end

View on GitHub (pinned to 1c9f0bb801)