instructure/canvas-lms · error · RuntimeError
Assessment type required for assessing
Error message
Assessment type required for assessing
What it means
RubricAssociation#assess requires params[:assessment_type] (the assessment hash inside opts). This guard fires when the assessment type — e.g. 'grading', 'peer_review', or 'summary' — is missing, so Canvas cannot determine what kind of rubric assessment to record. It is a fail-fast contract check before assessment processing begins.
Solutions
- Include assessment_type in the assessment hash: assessment: {assessment_type: 'grading', ...criterion scores}
- Use a supported type: 'grading', 'peer_review', or 'summary' — an unsupported value will fail downstream
- Validate params before calling: raise 'assessment_type missing' unless params[:assessment_type]
Example fix
// before
rubric_association.assess(
user: student, assessor: assessor, artifact: submission,
assessment: { score: 8 }
)
// after
rubric_association.assess(
user: student, assessor: assessor, artifact: submission,
assessment: { assessment_type: 'grading', score: 8 }
) Defensive patterns
Strategy: validation
Validate before calling
raise 'assessment_type missing' unless params[:assessment_type].in?(%w[grading peer_review summary])
Type guard
valid = %w[grading peer_review summary].include?(params[:assessment_type])
Try / catch
begin rubric_association.assess(opts) rescue RuntimeError => e handle_missing_type if e.message == 'Assessment type required for assessing' end
Prevention
- Always set assessment_type: 'grading' (or peer_review/summary) in the assessment hash
- Centralize assessment param construction
- Validate params at the API boundary
When it happens
Trigger: Calling rubric_association.assess(user:, assessor:, artifact:) with an :assessment hash lacking the :assessment_type key; API/controller callers forwarding only score/criterion params without assessment_type; assessment params built dynamically and the type key dropped.
Common situations: Custom grading tools that copy example payloads missing assessment_type; version changes/integrations using old param names; peer-review automation scripts that set other assessment fields but forget the type.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Artifact required for assessing
- Assessor required for assessing
- assessor and assessee required
- association required
- Cannot find # for ID: #
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/86d5498fb8a3a751.
Report an issue: GitHub.
Appendix: source
Thrown at app/models/rubric_association.rb:311
def assessment_points(criterion, data)
if criterion.learning_outcome_id && !context.feature_enabled?(:outcome_extra_credit)
[criterion.points, data[:points].to_f].min
else
data[:points].to_f
end
end
protected :assessment_points
def assess(opts = {})
# TODO: what if this is for a group assignment? Seems like it should
# give all students for the group assignment the same rubric assessment
# results.
association = self
params = opts[:assessment]
raise "User required for assessing" unless opts[:user]
raise "Assessor required for assessing" unless opts[:assessor]
raise "Artifact required for assessing" unless opts[:artifact]
raise "Assessment type required for assessing" unless params[:assessment_type]
if opts[:artifact].is_a?(Quizzes::QuizSubmission)
opts[:artifact] = association_object.find_or_create_submission(opts[:artifact].user)
end
if association_object.is_a?(Assignment) && !association_object.grade_group_students_individually
group, students_to_assess = association_object.group_students(opts[:artifact].student)
if group
provisional_grader = opts[:artifact].is_a?(ModeratedGrading::ProvisionalGrade) && opts[:assessor]
artifacts_to_assess = students_to_assess.map do |student|
association_object.find_asset_for_assessment(self, student, provisional_grader:).first
end
else
artifacts_to_assess = [opts[:artifact]]
end
else
artifacts_to_assess = [opts[:artifact]]
endView on GitHub (pinned to 1c9f0bb801)