{"record":{"id":"ec202540d61d6db1","repo":"instructure/canvas-lms","slug":"assignment-has-self-assessments-or-due-date-has-passed","errorCode":null,"errorMessage":"Assignment has self assessments or due date has passed","messagePattern":"Assignment has self assessments or due date has passed","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/set_rubric_self_assessment.rb","lineNumber":54,"sourceCode":"\n      unless rubric_association.grants_right?(current_user, session, :update)\n        raise GraphQL::ExecutionError, I18n.t(\"Insufficient permissions\")\n      end\n\n      if assignment.has_group_category?\n        raise GraphQL::ExecutionError, I18n.t(\"Cannot set rubric self assessment for group assignments\")\n      end\n\n      if assignment.quiz_lti? || assignment.quiz?\n        raise GraphQL::ExecutionError, I18n.t(\"Cannot set rubric self assessment for quiz assignments\")\n      end\n\n      if assignment.discussion_topic?\n        raise GraphQL::ExecutionError, I18n.t(\"Cannot set rubric self assessment for discussion assignments\")\n      end\n\n      unless assignment.can_update_rubric_self_assessment?\n        raise GraphQL::ExecutionError, I18n.t(\"Assignment has self assessments or due date has passed\")\n      end\n\n      rubric_self_assessment_enabled = input[:rubric_self_assessment_enabled]\n\n      if assignment.update(rubric_self_assessment_enabled:)\n        { rubric_self_assessment_enabled: }\n      else\n        errors_for(assignment)\n      end\n    rescue ActiveRecord::RecordNotFound => e\n      raise GraphQL::ExecutionError, \"#{e.model} not found\"\n    end\n  end\nend\n","sourceCodeStart":36,"sourceCodeEnd":69,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/set_rubric_self_assessment.rb#L36-L69","documentation":"SetRubricSelfAssessment raises this GraphQL::ExecutionError when assignment.can_update_rubric_self_assessment? returns false (app/graphql/mutations/set_rubric_self_assessment.rb:54). This means the assignment already has student self assessments recorded, or its due date has passed — both of which make the setting no longer editable.","triggerScenarios":"Invoking the setRubricSelfAssessment mutation on an assignment that already has rubric self assessments submitted by students, or whose due date is in the past, while all earlier validation (permissions, group/quiz/discussion type) passes.","commonSituations":"Teacher tries to disable self assessment after students already submitted one; user attempts the change after the semester/due date ended; importing or copying settings from a template assignment that already has self assessments.","solutions":["Toggle self assessment only before the assignment due date and before any self assessments exist.","Check assignment.can_update_rubric_self_assessment? / due date client-side before calling the mutation.","Disable or lock the UI toggle once due date passes or submissions exist.","Contact an admin or use course-level tooling if a deadline extension is appropriate, then retry."],"exampleFix":"// before\nawait client.mutate({ mutation: SET_SELF_ASSESSMENT, variables: { assignmentId } })\n// after\nif (assignment.canUpdateRubricSelfAssessment) {\n  await client.mutate({ mutation: SET_SELF_ASSESSMENT, variables: { assignmentId } })\n}","handlingStrategy":"validation","validationCode":"if (!assignment.canUpdateRubricSelfAssessment) throw new SkipMutation('self assessments exist or due date passed')","typeGuard":null,"tryCatchPattern":"try { await mutate(...) } catch (e) { if (e.message.includes('due date has passed')) showLockedNotice(); else throw e; }","preventionTips":["Check due date and existing self assessments before showing the toggle.","Disable the toggle once submissions/self assessments exist.","Warn users near the due date that the setting will lock."],"tags":["graphql","invalid-state","due-date","self-assessment","canvas"],"backgroundTag":"invalid-state-transition","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"}