instructure/canvas-lms · error · Checkpoints::FlagDisabledError
discussion_checkpoints feature flag must be enabled
Error message
discussion_checkpoints feature flag must be enabled
What it means
Checkpoints::DiscussionCheckpointCommonService#validate_flag_enabled checks that the discussion topic's root context has the discussion_checkpoints feature enabled via discussion_checkpoints_enabled?. If not, it raises FlagDisabledError. All discussion checkpoint create/update/delete services run this guard before doing any work, since checkpoints are gated behind the feature flag.
Solutions
- Enable the discussion_checkpoints feature flag for the account (or site admin) via Account settings UI or rails console: account.enable_feature!(:discussion_checkpoints).
- In tests, stub the flag before calling the service.
- Confirm the discussion topic belongs to a Course context, not a group/user context without the flag.
Example fix
// before (spec) creator.call(discussion_topic:, dates: ...) // after allow_any_instance_of(Account).to receive(:discussion_checkpoints_enabled?).and_return(true) creator.call(discussion_topic:, dates: ...)
Defensive patterns
Strategy: try-catch
Validate before calling
unless discussion_topic.context.discussion_checkpoints_enabled? raise Checkpoints::FlagDisabledError end
Try / catch
begin
service.call(...)
rescue Checkpoints::FlagDisabledError
render json: { error: 'discussion_checkpoints is not enabled for this context' }, status: :forbidden
end Prevention
- Enable discussion_checkpoints on the account (or in specs) before exercising checkpoint services
- Gate UI/API routes for checkpoints on the same flag check so calls never reach the service
- Remember the check is per discussion_topic.context — group/user contexts behave differently
When it happens
Trigger: Any create/update/delete call on Checkpoints discussion services (e.g. DiscussionCheckpointCreatorService#call) for a course/account where the :discussion_checkpoints feature flag is off; calling with a discussion_topic in a context (e.g. a user or group context) that doesn't support the flag.
Common situations: Testing checkpoint code locally without enabling the flag; staging/production environments where the flag hasn't been enabled for the account; requests hitting a course in an account that opted out; specs that forget to stub Account.site_admin.feature_enabled?(:discussion_checkpoints).
Related errors
- Checkpoint '# ' not found
- Checkpoints not found
- each date must have a type specified ('everyone' or…
- Cannot use initial token: account does not have…
- Course does not exist
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/2df46bd787353986.
Report an issue: GitHub.
Appendix: source
Thrown at app/services/checkpoints/discussion_checkpoint_common_service.rb:37
class Checkpoints::DiscussionCheckpointCommonService < ApplicationService
def initialize(discussion_topic:, checkpoint_label:, dates:, points_possible: nil, replies_required: 1, saved_by: nil, updating_user: nil)
super()
@discussion_topic = discussion_topic
@assignment = discussion_topic.assignment
@checkpoint_label = checkpoint_label
@dates = dates
@points_possible = points_possible
@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 reviewsView on GitHub (pinned to 1c9f0bb801)