{"record":{"id":"2e240c6091cf8ba9","repo":"instructure/canvas-lms","slug":"friendly-description-is-too-long-maximum-is-255-characters","errorCode":null,"errorMessage":"Friendly description is too long (maximum is 255 characters)","messagePattern":"Friendly description is too long \\(maximum is 255 characters\\)","errorType":"validation","errorClass":"InvalidDataError","httpStatus":null,"severity":"error","filePath":"lib/outcomes/csv_importer.rb","lineNumber":165,"sourceCode":"\n      invalid = (headers - OPTIONAL_FIELDS - REQUIRED_FIELDS).map(&:to_s)\n      raise ParseError, I18n.t(\"Invalid fields: %{fields}\", fields: invalid.inspect) unless invalid.empty?\n\n      headers\n    end\n\n    def import_row(headers, row)\n      simple = headers.zip(row).to_h\n      ratings = row[headers.length..]\n\n      object = simple.to_h\n      object[:ratings] = parse_ratings(ratings)\n      object[:learning_outcome_group_id] = @import[:learning_outcome_group_id]\n      if object[:mastery_points].present?\n        object[:mastery_points] = strict_parse_float(object[:mastery_points], I18n.t(\"mastery points\"))\n      end\n      if object[:friendly_description].present? && object[:friendly_description].length > 255\n        raise InvalidDataError, I18n.t(\"Friendly description is too long (maximum is 255 characters)\")\n      end\n\n      import_object(object)\n    end\n\n    def parse_ratings(ratings)\n      prior = nil\n      drop_trailing_nils(ratings).each_slice(2).to_a.map.with_index(1) do |(points, description), index|\n        raise InvalidDataError, I18n.t(\"Points for rating tier %{index} not present\", index:) if points.nil? || points.blank?\n\n        points = strict_parse_float(points, I18n.t(\"rating tier %{index} threshold\", index:))\n\n        if prior.present? && prior < points\n          raise InvalidDataError, I18n.t(\n            \"Points for tier %{index} must be less than points for prior tier (%{points} is greater than %{prior})\",\n            index:,\n            prior:,\n            points:","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/outcomes/csv_importer.rb#L147-L183","documentation":"Raised by Outcomes::CsvImporter#import_row when the friendly_description column value exceeds 255 characters. LearningOutcome friendly_description is stored in a varchar(255) column, so the importer pre-validates length and raises InvalidDataError rather than letting the DB fail. The limit is on character length of the plain-text short description.","triggerScenarios":"A row whose friendly_description cell contains more than 255 characters (e.g. a full paragraph pasted into the short description column instead of the long description column).","commonSituations":"Authors confusing friendly_description (short display name/description) with the full description field; copy-pasting marketing text; migrations from systems without a 255-char cap.","solutions":["Shorten the friendly_description cell to 255 characters or fewer.","Move the long text into the description column, keeping friendly_description as a concise label.","Pre-validate the column lengths in a script before running the import."],"exampleFix":"// before\nfriendly_description: \"An extremely long description...\"*(200 chars more)\n// after\nfriendly_description: description.first(255) # or a concise summary","handlingStrategy":"validation","validationCode":"desc = row['friendly_description'].to_s\nraise 'friendly_description exceeds 255 chars' if desc.length > 255","typeGuard":null,"tryCatchPattern":"begin\n  importer.run\nrescue Outcomes::Import::InvalidDataError => e\n  mark_row_failed(e.message)\nend","preventionTips":["Keep friendly_description short; put long text in description","Add a spreadsheet data-validation rule limiting the column to 255 chars","Truncate with .first(255) in preprocessing scripts"],"tags":["csv","validation","length-limit","import"],"backgroundTag":"value-out-of-range","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}