{"record":{"id":"eda542cb0ca8a1dd","repo":"instructure/canvas-lms","slug":"failed-deleting-an-event-from-the-series-update-not-saved","errorCode":null,"errorMessage":"Failed deleting an event from the series, update not saved","messagePattern":"Failed deleting an event from the series, update not saved","errorType":"http","errorClass":"ActiveRecord::Rollback","httpStatus":400,"severity":"error","filePath":"app/controllers/calendar_events_api_controller.rb","lineNumber":1077,"sourceCode":"\n    events = events.to_a\n    update_limit = rrule_changed ? RruleHelper::RECURRING_EVENT_LIMIT : events.length\n\n    events.each do |ev|\n      ev.saving_user = @current_user\n    end\n\n    error = nil\n    CalendarEvent.skip_touch_context do\n      CalendarEvent.transaction do\n        dtstart_list = rr.present? ? rr.all(limit: update_limit) : []\n        if rr.present? && events.length > dtstart_list.length\n          # truncate the list of events we're updating to how many\n          # we'll end up with given the (possible updated) rrule\n          events.drop(dtstart_list.length).each do |event|\n            unless event.grants_any_right?(@current_user, session, :delete)\n              error = { message: t(\"Failed deleting an event from the series, update not saved\"), status: :unauthorized }\n              raise ActiveRecord::Rollback\n            end\n\n            unless event.destroy\n              error = { message: t(\"Failed deleting an event from the series, update not saved\") }\n              raise ActiveRecord::Rollback\n            end\n          end\n          events = events.take(dtstart_list.length)\n        end\n\n        if new_series_head\n          events[0].series_head = true\n        end\n\n        dtstart_list.each_with_index do |dtstart, i|\n          params_for_update = set_series_params(params_for_update, dtstart, duration)\n          event = events[i]\n          event.update_all = true if which != \"one\" && event&.series_uuid && event.series_head","sourceCodeStart":1059,"sourceCodeEnd":1095,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/controllers/calendar_events_api_controller.rb#L1059-L1095","documentation":"Guard inside update_from_series' transaction: when persisting an updated recurring calendar event series, updating one of the per-occurrence events failed (event.update or save returned false). The whole transaction is rolled back so the series is left consistent, and this sentinel error reports which event failed.","triggerScenarios":"Thrown at app/controllers/calendar_events_api_controller.rb:1077 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the event's errors collection for the actual validation failure (e.g. invalid start_at/duration or context constraints)","Verify the rrule change doesn't leave events outside the RRULE's occurrences","Retry the update with corrected params; ensure the caller passes valid series update attributes"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}