instructure/canvas-lms · error

Unknown GradingStandard data version: #

Error message

Unknown GradingStandard data version: #{version}

What it means

GradingStandard.data(version) is a versioned deserializer for grading scheme data. It supports specific known versions (implicitly 1 and 2 in the surrounding code); any other stored version string reaches the else branch and raises, meaning the data shape/version cannot be interpreted safely.

Solutions

  1. Inspect the offending GradingStandard row's data version and correct it to a supported value (1 or 2)
  2. Upgrade Canvas (or the grading standard gem code) to a version that supports the stored data version
  3. Recreate the grading standard with a supported scheme instead of importing the incompatible payload
  4. Sanitize imported course-copy/export payloads to known versions before persisting

Example fix

// before
GradingStandard.import(some_newer_export) # data version unknown to this build
// after
standard = GradingStandard.new(grading_scheme: normalized_scheme)
# normalize the imported scheme to the current data format/version first
Defensive patterns

Strategy: validation

Validate before calling

version = standard.data_version
raise "unsupported grading standard version #{version}" unless [1, 2].include?(version)

Try / catch

begin
  scheme = grading_standard.data
rescue RuntimeError => e
  raise unless e.message.start_with?('Unknown GradingStandard data version')
  scheme = default_scheme
end

Prevention

When it happens

Trigger: Loading a GradingStandard whose stored data version field contains an unrecognized value — corrupt or hand-edited data, data written by a newer Canvas version, or a migration that left version nil/unexpected.

Common situations: Importing grading standards exported from a newer Canvas release into an older one; manual DB edits or course-copy corruption of grading_standards.data; plugins/older code paths writing a version this build doesn't know.

Related errors


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

Appendix: source

Thrown at app/models/grading_standard.rb:242

      data = super
      data = GradingStandard.upgrade_data(data, version) unless data.nil?
      self.data = data
    end
    super
  end

  def self.upgrade_data(data, version)
    case version.to_i
    when VERSION
      data
    when 1
      0.upto(data.length - 2) do |i|
        data[i][1] = data[i + 1][1] + 0.01
      end
      data[-1][1] = 0
      data
    else
      raise "Unknown GradingStandard data version: #{version}"
    end
  end

  def trim_whitespace
    data.each do |scheme|
      scheme.first.strip!
    end
  end
  private :trim_whitespace

  def update_usage_count
    self.usage_count = assignments.active.count
    self.context_code = context_type && "#{context_type.underscore}_#{context_id}"
  end

  def prevent_deletion_of_used_schemes
    return unless Account.site_admin.feature_enabled?(:archived_grading_schemes) && assessed_assignment?

View on GitHub (pinned to 1c9f0bb801)