{"record":{"id":"2c477b05e407595f","repo":"instructure/canvas-lms","slug":"cannot-set-rubric-self-assessment-for-discussion-assignments","errorCode":null,"errorMessage":"Cannot set rubric self assessment for discussion assignments","messagePattern":"Cannot set rubric self assessment for discussion assignments","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/set_rubric_self_assessment.rb","lineNumber":50,"sourceCode":"\n      unless assignment.active_rubric_association?\n        raise GraphQL::ExecutionError, I18n.t(\"Rubric Association not found\")\n      end\n\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","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/set_rubric_self_assessment.rb#L32-L68","documentation":"SetRubricSelfAssessment raises this GraphQL::ExecutionError when assignment.discussion_topic? is true (app/graphql/mutations/set_rubric_self_assessment.rb:50). Discussion-backed assignments do not support rubric self assessment, so the mutation rejects them.","triggerScenarios":"Invoking the setRubricSelfAssessment mutation with an assignment ID whose assignment is backed by a discussion topic (graded discussion).","commonSituations":"A tool or UI lists all course assignments without excluding graded discussions; teacher tries toggling self assessment from a discussion assignment page; scripts that sync rubric settings across a course encounter discussion assignments.","solutions":["Filter out discussion-topic-backed assignments before calling the mutation.","Query assignment.discussion_topic (or its GraphQL type) beforehand and skip those.","Show the self assessment control only on plain assignments.","Use discussion-level rubric assessment options instead of self assessment."],"exampleFix":"// before\nawait client.mutate({ mutation: SET_SELF_ASSESSMENT, variables: { assignmentId } })\n// after\nif (!assignment.discussionTopic) {\n  await client.mutate({ mutation: SET_SELF_ASSESSMENT, variables: { assignmentId } })\n}","handlingStrategy":"validation","validationCode":"if (assignment.discussionTopic) throw new SkipMutation('discussion assignments unsupported')","typeGuard":null,"tryCatchPattern":"try { await mutate(...) } catch (e) { if (e.message.includes('discussion assignments')) showUnsupportedNotice(); else throw e; }","preventionTips":["Exclude graded discussions from self assessment controls.","Check the assignment's type in the GraphQL fragment used by the UI.","Test with all assignment types (plain, quiz, discussion, group) before rollout."],"tags":["graphql","unsupported-operation","discussions","canvas"],"backgroundTag":"unsupported-operation","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"}