instructure/canvas-lms · error · Checkpoints::InvalidDateTypeError
invalid date type: #
Error message
invalid date type: #{date[:type]} What it means
In validate_dates, after confirming a date's :type is present, it is checked against the whitelist %w[everyone override]; any other value raises InvalidDateTypeError with the offending value. This prevents silently ignoring misspelled types that would otherwise produce dates no service handles.
Solutions
- Change the date's type to exactly 'everyone' or 'override' (lowercase).
- Fix client-side dropdown/enum mappings that emit different strings.
- If a new type is genuinely needed, update valid_date_types in discussion_checkpoint_common_service.rb along with handling code.
Example fix
// before
dates: [{ type: 'overrides', due_at: t }]
// after
dates: [{ type: 'override', due_at: t }] Defensive patterns
Strategy: validation
Validate before calling
VALID = %w[everyone override].freeze
dates.each { |d| raise ArgumentError, "bad type #{d[:type]}" unless VALID.include?(d[:type]) } Type guard
def valid_date_types?(dates)
dates.all? { |d| %w[everyone override].include?(d[:type].to_s) }
end Try / catch
begin
service.call(...)
rescue Checkpoints::InvalidDateTypeError => e
render json: { error: e.message }, status: :bad_request
end Prevention
- Use a shared enum constant for date types across client and server
- Never use AssignmentOverride set_type strings as date types
- Test payloads with both allowed values to catch typos early
When it happens
Trigger: Passing a date hash whose :type is non-blank but not 'everyone'/'override', e.g. type: 'section', 'student', 'Everyone', 'all', or 'overrides' (plural).
Common situations: Typos and casing mistakes in client payloads; developers extending the date model with new types without updating this whitelist; other Canvas date vocabularies (e.g. 'CourseSection' set_type) mistakenly used as the type value.
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
- each date must have a type specified ('everyone' or…
- " " must be either " " or
- set_type is required, but was not provided
- set_type of '# ' not supported. Supported types: #
- Student ids are not in course
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/ac9a649d5cedafa3.
Report an issue: GitHub.
Appendix: source
Thrown at app/services/checkpoints/discussion_checkpoint_common_service.rb:49
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
group_category_id
position
submission_typesView on GitHub (pinned to 1c9f0bb801)