instructure/canvas-lms · error · InvalidDataError

Invalid value for

Error message

Invalid value for %{name}: "%{i}"

What it means

Raised by Outcomes::CsvImporter#strict_parse_float when a value that must be a number (mastery points, rating tier threshold, calculation intensity) cannot be parsed by Ruby's Float(). The value is first passed through normalize_i18n (stripping thousands delimiters, converting decimal separators); only strings still unparsable raise this InvalidDataError naming the field and offending value.

Solutions

  1. Enter a plain numeric value in the cell, e.g. 3 or 4.5, with no units or text.
  2. Match the expected number format: the importer's i18n delimiter/separator settings (e.g. 1.234,5 for European formats if configured).
  3. Clean the CSV (strip currency symbols, footnotes, spaces) before import.

Example fix

// before
mastery_points: "3 points"
// after
mastery_points: 3
Defensive patterns

Strategy: validation

Validate before calling

def parseable_float?(v)
  Float(v.to_s.gsub(',', '').gsub(/\A\z/) { })
  true
rescue ArgumentError
  false
end
raise 'bad number' unless parseable_float?(row['mastery_points'])

Try / catch

begin
  importer.run
rescue Outcomes::Import::InvalidDataError => e
  errors << "Row #{i}: #{e.message}" # includes offending value
end

Prevention

When it happens

Trigger: Mastery points cell containing text like 'high' or '3 points'; a value like '1,5.5' that survives i18n normalization; cells with stray characters (currency symbols, spaces-as-thousands that aren't the expected delimiter); an empty-but-present string reached strict_parse_float via a non-blank check path.

Common situations: Localized number formats different from the importer's expected delimiters/separators (e.g. unusual thousands separators); typos or units typed into numeric columns; spreadsheet formatting that exported numbers as text with annotations.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at lib/outcomes/csv_importer.rb:203

        end

        prior = points
        { points:, description: }
      end
    end

    def normalize_i18n(string)
      raise ArgumentError if string.blank?

      separator = I18n.t("number.format.separator")
      delimiter = I18n.t("number.format.delimiter")
      string.gsub(delimiter, "").gsub(separator, ".")
    end

    def strict_parse_float(v, name)
      Float(normalize_i18n(v))
    rescue ArgumentError
      raise InvalidDataError, I18n.t('Invalid value for %{name}: "%{i}"', name:, i: v)
    end

    def drop_trailing_nils(array)
      array.pop while array.last.nil? && !array.empty?
      array
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)