{"record":{"id":"b63303b217abf6dd","repo":"instructure/canvas-lms","slug":"set-id-is-required-but-was-not-provided-b63303","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_updater_service.rb","lineNumber":35,"sourceCode":"# 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::SectionOverrideUpdaterService < 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    override = @checkpoint.assignment_overrides.find_by(id: @override[:id], set_type: AssignmentOverride::SET_TYPE_COURSE_SECTION)\n    raise Checkpoints::OverrideNotFoundError unless override\n\n    section_id = @override.fetch(:set_id, nil) || override.set_id\n\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    current_section = override.set\n\n    update_override(override:, section:)\n\n    parent_override = @checkpoint.parent_assignment.active_assignment_overrides.find_by(set: current_section)\n    raise Checkpoints::OverrideNotFoundError unless parent_override\n\n    update_override(override: parent_override, section:, shell_override: true)\n\n    override\n  end\n\n  def update_override(override:, section:, shell_override: false)\n    override.set = section if section.id != override.set_id\n    apply_overridden_dates(override, @override, shell_override:)","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/services/checkpoints/section_override_updater_service.rb#L17-L53","documentation":"Checkpoints::SectionOverrideUpdaterService#call updates a checkpoint assignment override from a course-section set. It resolves the target section_id from the @override hash's :set_id, falling back to the existing override's set_id. If both are blank it raises SetIdRequiredError because a section override cannot be repointed without knowing which section it applies to.","triggerScenarios":"Calling Checkpoints::SectionOverrideUpdaterService.call (or .new(...).call) where @override[:set_id] is absent/nil AND the existing AssignmentOverride record found by @override[:id] has a blank set_id (e.g. a 'Everyone' / no-section override was passed instead of a section-scoped one).","commonSituations":"Frontend sends an override payload without set_id; the override id points at a group or default 'everyone' override rather than a course-section override; data migration or import created section-type overrides with null set_id.","solutions":["Pass set_id in the override hash passed to the service (the target course section id).","Verify the :id in the payload resolves to an AssignmentOverride with set_type 'CourseSection' and a non-blank set_id; pick the correct override id otherwise.","Add a caller-side presence check on override[:set_id] before invoking the service and surface a clearer API error.","Backfill/correct AssignmentOverride records with blank set_id via a data fix if this comes from bad data."],"exampleFix":"// before\nservice.call(checkpoint:, override: { id: 42 })\n// after\nservice.call(checkpoint:, override: { id: 42, set_id: course_section.id })","handlingStrategy":"validation","validationCode":"raise ArgumentError, 'set_id required' if override[:set_id].blank? && AssignmentOverride.find_by(id: override[:id])&.set_id.blank?","typeGuard":null,"tryCatchPattern":"begin\n  Checkpoints::SectionOverrideUpdaterService.call(...)\nrescue Checkpoints::SetIdRequiredError => e\n  render json: { error: 'set_id is required for section overrides' }, status: :bad_request\nend","preventionTips":["Always include set_id in override payloads for section-type overrides","Validate override[:set_id] presence in the controller before calling the service","Never pass 'everyone'/group overrides to the section override updater","Add a model-level presence validation for set_id on section overrides"],"tags":["ruby","validation","assignment-overrides"],"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"}