instructure/canvas-lms · error
invalid description value: #
Error message
invalid description value: #{rating[:description]} What it means
OutcomesAcademicBenchmarkImportApiController#parse_rating checks that each rating has a non-nil String :description and raises otherwise. The description names the mastery level and is required for every rating in the array.
Solutions
- Include a string description on every rating object.
- Map alternate keys (e.g. 'label') to description before sending.
- Coerce numeric labels to strings only if that is the intent; otherwise supply real text.
- Validate presence and type of description client-side.
Example fix
// before
ratings: [{ points: 3 }]
// after
ratings: [{ description: "Mastery", points: 3 }] Defensive patterns
Strategy: validation
Validate before calling
raise ArgumentError unless ratings.all? { |r| r[:description].is_a?(String) && !r[:description].empty? } Type guard
def described_rating?(r) = r[:description].is_a?(String) && !r[:description].nil?
Try / catch
begin
import_outcomes(options)
rescue RuntimeError => e
raise InvalidRatingDescription, e.message if e.message.start_with?('invalid description value:')
raise
end Prevention
- Always include a non-empty string description per rating.
- Map alternate label keys to description before sending.
- Don't send numeric level ids as descriptions.
- Validate description presence/type client-side.
When it happens
Trigger: A ratings entry missing :description, having nil description, or a non-string description (number, hash) — e.g. { points: 3 } or { description: 5, points: 3 }.
Common situations: Forms that send the rating label under a different key (name/label instead of description); JSON where description was dropped by a serializer; clients sending numeric level indexes instead of text.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- invalid ratings value: #
- ratings expected to be an array
- Cannot change locked status on granular permission
- GUID is invalid: #
- Invalid action.
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/25910b5725af846c.
Report an issue: GitHub.
Appendix: source
Thrown at app/controllers/outcomes_academic_benchmark_import_api_controller.rb:140
value
end
def parse_calculation_int(calc_method, value)
int = value.nil? ? nil : parse_int(value)
unless LearningOutcome.valid_calculation_int?(int, calc_method)
raise "invalid calculation_int: #{value}"
end
int
end
def parse_rating(rating)
if rating.nil? || !rating.is_a?(ActionController::Parameters)
raise "invalid ratings value: #{rating}"
end
if rating[:description].nil? || !rating[:description].is_a?(String)
raise "invalid description value: #{rating[:description]}"
end
{ description: rating[:description], points: parse_int(rating[:points]) }
end
end
View on GitHub (pinned to 1c9f0bb801)