instructure/canvas-lms · error · GraphQL::ExecutionError

Cannot set rubric self assessment for discussion assignments

Error message

Cannot set rubric self assessment for discussion assignments

What it means

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.

Solutions

  1. Filter out discussion-topic-backed assignments before calling the mutation.
  2. Query assignment.discussion_topic (or its GraphQL type) beforehand and skip those.
  3. Show the self assessment control only on plain assignments.
  4. Use discussion-level rubric assessment options instead of self assessment.

Example fix

// before
await client.mutate({ mutation: SET_SELF_ASSESSMENT, variables: { assignmentId } })
// after
if (!assignment.discussionTopic) {
  await client.mutate({ mutation: SET_SELF_ASSESSMENT, variables: { assignmentId } })
}
Defensive patterns

Strategy: validation

Validate before calling

if (assignment.discussionTopic) throw new SkipMutation('discussion assignments unsupported')

Try / catch

try { await mutate(...) } catch (e) { if (e.message.includes('discussion assignments')) showUnsupportedNotice(); else throw e; }

Prevention

When it happens

Trigger: Invoking the setRubricSelfAssessment mutation with an assignment ID whose assignment is backed by a discussion topic (graded discussion).

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/2c477b05e407595f. Report an issue: GitHub.

Appendix: source

Thrown at app/graphql/mutations/set_rubric_self_assessment.rb:50

      unless assignment.active_rubric_association?
        raise GraphQL::ExecutionError, I18n.t("Rubric Association not found")
      end

      unless rubric_association.grants_right?(current_user, session, :update)
        raise GraphQL::ExecutionError, I18n.t("Insufficient permissions")
      end

      if assignment.has_group_category?
        raise GraphQL::ExecutionError, I18n.t("Cannot set rubric self assessment for group assignments")
      end

      if assignment.quiz_lti? || assignment.quiz?
        raise GraphQL::ExecutionError, I18n.t("Cannot set rubric self assessment for quiz assignments")
      end

      if assignment.discussion_topic?
        raise GraphQL::ExecutionError, I18n.t("Cannot set rubric self assessment for discussion assignments")
      end

      unless assignment.can_update_rubric_self_assessment?
        raise GraphQL::ExecutionError, I18n.t("Assignment has self assessments or due date has passed")
      end

      rubric_self_assessment_enabled = input[:rubric_self_assessment_enabled]

      if assignment.update(rubric_self_assessment_enabled:)
        { rubric_self_assessment_enabled: }
      else
        errors_for(assignment)
      end
    rescue ActiveRecord::RecordNotFound => e
      raise GraphQL::ExecutionError, "#{e.model} not found"
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)