{"record":{"id":"ec0118d6c35e5c36","repo":"instructure/canvas-lms","slug":"set-id-is-required-but-was-not-provided-section-override","errorCode":null,"errorMessage":"set_id is required, but was not provided","messagePattern":"set_id is required, but was not provided","errorType":"exception","errorClass":"Checkpoints::SetIdRequiredError","httpStatus":null,"severity":"error","filePath":"app/services/checkpoints/section_override_creator_service.rb","lineNumber":30,"sourceCode":"# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n# details.\n#\n# You should have received a copy of the GNU Affero General Public License along\n# with this program. If not, see <http://www.gnu.org/licenses/>.\n\nclass Checkpoints::SectionOverrideCreatorService < ApplicationService\n  include Checkpoints::DateOverrider\n\n  def initialize(checkpoint:, override:)\n    super()\n    @checkpoint = checkpoint\n    @override = override\n  end\n\n  def call\n    section_id = @override.fetch(:set_id) { raise Checkpoints::SetIdRequiredError, \"set_id is required, but was not provided\" }\n    raise Checkpoints::SetIdRequiredError, \"set_id is required, but was not provided\" if section_id.blank?\n\n    section = @checkpoint.course.active_course_sections.find(section_id)\n\n    parent_override = parent_override(section)\n    create_override(assignment: @checkpoint, section:, parent_override:)\n  end\n\n  private\n\n  def create_override(assignment:, section:, shell_override: false, parent_override: nil)\n    override = assignment.assignment_overrides.build(set: section, dont_touch_assignment: true, parent_override:, unassign_item: @override.fetch(:unassign_item, false))\n    apply_overridden_dates(override, @override, shell_override:)\n    override.save!\n    override\n  end\n\n  def parent_override(section)","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/services/checkpoints/section_override_creator_service.rb#L12-L48","documentation":"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.","triggerScenarios":"Calling Checkpoints::SectionOverrideCreatorService with a payload like {due_at: t} missing set_id; the first line of call raises immediately.","commonSituations":"Frontend submits 'everyone else' style overrides without a section; API consumers omit set_id; renamed field (section_id -> set_id) in client not updated.","solutions":["Pass set_id (course section id) in the override hash","Validate presence of set_id on the client before submitting","Map legacy section_id keys to set_id in the API layer","Rescue Checkpoints::SetIdRequiredError and return a 400"],"exampleFix":"// before\nCheckpoints::SectionOverrideCreatorService.new(checkpoint, { due_at: t }).call\n// after\nCheckpoints::SectionOverrideCreatorService.new(checkpoint, { set_id: section.id, due_at: t }).call","handlingStrategy":"validation","validationCode":"raise ArgumentError, 'set_id required' unless override.is_a?(Hash) && override.key?(:set_id)\nCheckpoints::SectionOverrideCreatorService.new(checkpoint, override).call","typeGuard":"def valid_section_override?(override)\n  override.is_a?(Hash) && override.key?(:set_id)\nend","tryCatchPattern":"begin\n  Checkpoints::SectionOverrideCreatorService.new(checkpoint, override).call\nrescue Checkpoints::SetIdRequiredError\n  render json: { errors: ['set_id is required for section overrides'] }, status: :bad_request\nend","preventionTips":["Always include set_id (section id) when creating section overrides","Rename legacy section_id keys to set_id in API clients","Add request schema validation before service invocation"],"tags":["rails","checkpoints","section-overrides","missing-parameter"],"backgroundTag":"missing-required-argument","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}