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

set_id is required, but was not provided

Error message

set_id is required, but was not provided

What it means

Checkpoints::SetIdRequiredError raised in SectionOverrideCreatorService#call when the override hash has no :set_id key (Hash#fetch with a raising block). Section overrides need the course section id to build the override and its parent mirror.

Solutions

  1. Pass set_id (course section id) in the override hash
  2. Validate presence of set_id on the client before submitting
  3. Map legacy section_id keys to set_id in the API layer
  4. Rescue Checkpoints::SetIdRequiredError and return a 400

Example fix

// before
Checkpoints::SectionOverrideCreatorService.new(checkpoint, { due_at: t }).call
// after
Checkpoints::SectionOverrideCreatorService.new(checkpoint, { set_id: section.id, due_at: t }).call
Defensive patterns

Strategy: validation

Validate before calling

raise ArgumentError, 'set_id required' unless override.is_a?(Hash) && override.key?(:set_id)
Checkpoints::SectionOverrideCreatorService.new(checkpoint, override).call

Type guard

def valid_section_override?(override)
  override.is_a?(Hash) && override.key?(:set_id)
end

Try / catch

begin
  Checkpoints::SectionOverrideCreatorService.new(checkpoint, override).call
rescue Checkpoints::SetIdRequiredError
  render json: { errors: ['set_id is required for section overrides'] }, status: :bad_request
end

Prevention

When it happens

Trigger: Calling Checkpoints::SectionOverrideCreatorService with a payload like {due_at: t} missing set_id; the first line of call raises immediately.

Common situations: Frontend submits 'everyone else' style overrides without a section; API consumers omit set_id; renamed field (section_id -> set_id) in client not updated.

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/ec0118d6c35e5c36. Report an issue: GitHub.

Appendix: source

Thrown at app/services/checkpoints/section_override_creator_service.rb:30

# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

class Checkpoints::SectionOverrideCreatorService < ApplicationService
  include Checkpoints::DateOverrider

  def initialize(checkpoint:, override:)
    super()
    @checkpoint = checkpoint
    @override = override
  end

  def call
    section_id = @override.fetch(:set_id) { raise Checkpoints::SetIdRequiredError, "set_id is required, but was not provided" }
    raise Checkpoints::SetIdRequiredError, "set_id is required, but was not provided" if section_id.blank?

    section = @checkpoint.course.active_course_sections.find(section_id)

    parent_override = parent_override(section)
    create_override(assignment: @checkpoint, section:, parent_override:)
  end

  private

  def create_override(assignment:, section:, shell_override: false, parent_override: nil)
    override = assignment.assignment_overrides.build(set: section, dont_touch_assignment: true, parent_override:, unassign_item: @override.fetch(:unassign_item, false))
    apply_overridden_dates(override, @override, shell_override:)
    override.save!
    override
  end

  def parent_override(section)

View on GitHub (pinned to 1c9f0bb801)