{"record":{"id":"6dc7e604ffe1ff04","repo":"instructure/canvas-lms","slug":"error-hiding-assignment-grades-for-sections","errorCode":null,"errorMessage":"Error hiding assignment grades for sections","messagePattern":"Error hiding assignment grades for sections","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/hide_assignment_grades_for_sections.rb","lineNumber":69,"sourceCode":"    visible_enrollments = course.apply_enrollment_visibility(course.student_enrollments, current_user, sections)\n\n    submissions_scope = input[:graded_only] ? assignment.submissions.graded : assignment.submissions\n    submissions_scope = submissions_scope.joins(user: :enrollments).merge(visible_enrollments)\n\n    progress = course.progresses.new(tag: \"hide_assignment_grades_for_sections\")\n\n    if progress.save\n      progress.process_job(\n        assignment,\n        :hide_submissions,\n        { preserve_method_args: true, priority: Delayed::HIGH_PRIORITY },\n        progress:,\n        submission_ids: submissions_scope.pluck(:id),\n        skip_content_participation_refresh: false\n      )\n      { assignment:, progress:, sections: }\n    else\n      raise GraphQL::ExecutionError, \"Error hiding assignment grades for sections\"\n    end\n  end\nend\n","sourceCodeStart":51,"sourceCodeEnd":73,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/hide_assignment_grades_for_sections.rb#L51-L73","documentation":"Raised when the Progress record created to track the background hide_submissions job fails to save (progress.save returns false). The mutation could not enqueue the background job, so no grades were hidden. Progress model validations (e.g. missing tag/context/user) are the usual cause.","triggerScenarios":"Calling hideAssignmentGradesForSections when course.progresses.new(tag: 'hide_assignment_grades_for_sections') fails validation on save — e.g. invalid progress state, database constraint, or a corrupted course/progress association.","commonSituations":"Database connection/replication issues during save; custom Progress validations from plugins; stalled progress rows from prior failed runs blocking new ones; data corruption in the courses record.","solutions":["Inspect progress.errors after reproduction (rails c) to see why Progress#save failed","Verify database connectivity and that the progresses table has no failing constraint/trigger","Check for plugins or overrides that add Progress validations","Retry the mutation; if persistent, examine course record validity (course.valid?)"],"exampleFix":"# server-side guard before raising a generic message\nprogress = course.progresses.new(tag: \"hide_assignment_grades_for_sections\")\nunless progress.save\n  raise GraphQL::ExecutionError, \"Error hiding assignment grades for sections: #{progress.errors.full_messages.join(', ')}\"\nend","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const res = await hideAssignmentGradesForSections(input);\n  // poll res.progress until completed; treat workflowState 'failed' as hidden-failure\n} catch (e) {\n  if (e.message.includes(\"Error hiding assignment grades for sections\")) {\n    // surface a retry prompt; check backend progress.errors for the real cause\n  }\n}","preventionTips":["Retry once on this error — it is often transient (DB save failure)","Check Progress validations and plugin overrides server-side if persistent","Monitor the progresses table for failed rows with tag hide_assignment_grades_for_sections"],"tags":["graphql","background-job","database","canvas-lms"],"backgroundTag":"database-write-failed","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"}