instructure/canvas-lms · error

grade publishing requires a grading standard

Error message

grade publishing requires a grading standard

What it means

Some grade export formats declare requires_grading_standard: true; if the course does not have a grading standard enabled, publishing raises this error because final grades cannot be mapped to letter grades without one.

Solutions

  1. Assign a grading standard to the course (course.grading_standard = ...; grading_standard_enabled = true) before publishing
  2. Switch the grade_export format_type to one that does not require a grading standard
  3. Check grading_standard_enabled? up front and surface a user-friendly validation message

Example fix

// before
course.publish_final_grades(teacher)
// after
course.grading_standard = GradingStandard.default_instance
course.save!
course.publish_final_grades(teacher)
Defensive patterns

Strategy: validation

Validate before calling

fmt = Canvas::Plugin.find!('grade_export').settings[:format_type]
requires_std = Course.valid_grade_export_types[fmt]&.dig(:requires_grading_standard)
raise 'assign a grading standard first' if requires_std && !course.grading_standard_enabled?

Type guard

null

Try / catch

begin
  course.publish_final_grades(user)
rescue RuntimeError => e
  raise unless e.message == 'grade publishing requires a grading standard'
  # prompt user to add a grading scheme to the course
end

Prevention

When it happens

Trigger: Calling publish_final_grades on a course whose grading_standard_enabled? is false while the configured grade_export format requires a grading standard.

Common situations: Courses created without a grading scheme being pushed to SIS via a letter-grade export format; admins changing course grading settings after publishing was configured.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at app/models/course.rb:2643

    recompute_student_scores_without_send_later(user_ids_to_publish)
    enrollments = student_enrollments.not_fake.eager_load(:user).preload(:course_section).order_by_sortable_name
    enrollments = enrollments.where(user_id: user_ids_to_publish) if user_ids_to_publish

    errors = []
    posts_to_make = []
    posted_enrollment_ids = []
    all_enrollment_ids = enrollments.map(&:id)

    begin
      raise "final grade publishing disabled" unless Canvas::Plugin.find!("grade_export").enabled?

      settings = Canvas::Plugin.find!("grade_export").settings
      raise "endpoint undefined" if settings[:publish_endpoint].blank?

      format_settings = Course.valid_grade_export_types[settings[:format_type]]
      raise "unknown format type: #{settings[:format_type]}" unless format_settings
      raise "grade publishing requires a grading standard" if !grading_standard_enabled? && format_settings[:requires_grading_standard]

      publishing_pseudonym = SisPseudonym.for(publishing_user, self)
      raise "publishing disallowed for this publishing user" if publishing_pseudonym.nil? && format_settings[:requires_publishing_pseudonym]

      callback = Course.valid_grade_export_types[settings[:format_type]][:callback]
      posts_to_make = callback.call(self, enrollments, publishing_user, publishing_pseudonym)
    rescue => e
      Enrollment.where(id: all_enrollment_ids).update_all(grade_publishing_status: "error", grade_publishing_message: e.to_s)
      raise e
    end

    default_timeout = Setting.get("send_final_grades_to_endpoint_timelimit", 15.seconds.to_s).to_f

    timeout_options = { raise_on_timeout: true, fallback_timeout_length: default_timeout }

    posts_to_make.each do |enrollment_ids, res, mime_type, headers = {}|
      posted_enrollment_ids += enrollment_ids
      if res

View on GitHub (pinned to 1c9f0bb801)