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

each date must have a type specified ('everyone' or…

Error message

each date must have a type specified ('everyone' or 'override')

What it means

DiscussionCheckpointCommonService#validate_dates iterates @dates and requires each date hash to include a non-blank :type ('everyone' or 'override'). A blank type raises DateTypeRequiredError. The type field drives which date list the entry belongs to (section-level 'everyone' dates vs per-student 'override' dates).

Solutions

  1. Add type: 'everyone' or type: 'override' to every date hash in the payload.
  2. Add presence-of-type validation on the client/controller before calling the service.
  3. Check any bulk/loop code building dates isn't dropping the type key for some entries.

Example fix

// before
dates: [{ due_at: '2026-01-01' }]
// after
dates: [{ type: 'everyone', due_at: '2026-01-01' }]
Defensive patterns

Strategy: validation

Validate before calling

dates.each { |d| raise ArgumentError, 'date type required' if d[:type].blank? }

Type guard

def typed_dates?(dates)
  dates.is_a?(Array) && dates.all? { |d| d.is_a?(Hash) && !d[:type].blank? }
end

Try / catch

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

Prevention

When it happens

Trigger: Passing a dates array containing an element without :type, or with type set to nil/"", e.g. dates: [{due_at: t}] or [{type: nil}].

Common situations: Frontend sending date objects with only due_at/unlock_at for the 'everyone' entry without tagging type; legacy payloads built before the type field was introduced; hand-written JSON in API calls missing the type key.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at app/services/checkpoints/discussion_checkpoint_common_service.rb:46

    @replies_required = replies_required
    @saved_by = saved_by
    @updating_user = updating_user
  end

  private

  def validate_flag_enabled
    unless @discussion_topic.context.discussion_checkpoints_enabled?
      raise Checkpoints::FlagDisabledError, "discussion_checkpoints feature flag must be enabled"
    end
  end

  def validate_dates
    valid_date_types = %w[everyone override].freeze

    @dates.each do |date|
      if date[:type].blank?
        raise Checkpoints::DateTypeRequiredError, "each date must have a type specified ('everyone' or 'override')"
      end
      unless valid_date_types.include?(date[:type])
        raise Checkpoints::InvalidDateTypeError, "invalid date type: #{date[:type]}"
      end
    end
  end

  def attributes_to_inherit_from_parent
    # TODO: handle peer reviews
    %w[
      assignment_group_id
      context_id
      context_type
      description
      grade_group_students_individually
      grading_type
      grading_standard_id
      group_category

View on GitHub (pinned to 1c9f0bb801)