{"record":{"id":"0de49c9a581b2ba7","repo":"instructure/canvas-lms","slug":"no-name-given-for-user","errorCode":null,"errorMessage":"No name given for user","messagePattern":"No name given for user","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/user_importer.rb","lineNumber":107,"sourceCode":"      def any_left_to_process?\n        !@batched_users.empty?\n      end\n\n      def infer_user_name(user_row, prior_name = nil)\n        if user_row.full_name.present?\n          user_row.full_name\n        elsif user_row.first_name.present? || user_row.last_name.present?\n          [user_row.first_name, user_row.last_name].join(\" \")\n        elsif prior_name.present?\n          prior_name\n        elsif user_row.sortable_name.present?\n          user_row.sortable_name\n        elsif user_row.short_name.present?\n          user_row.short_name\n        elsif user_row.login_id.present?\n          user_row.login_id\n        else\n          raise ImportError, \"No name given for user\"\n        end\n      end\n\n      def infer_sortable_name(user_row, prior_sortable_name = nil)\n        if user_row.sortable_name.present?\n          user_row.sortable_name\n        elsif user_row.full_name.present?\n          nil # force User model to infer sortable name from the full name\n        elsif user_row.last_name.present? || user_row.first_name.present?\n          [user_row.last_name, user_row.first_name].join(\", \")\n        else\n          prior_sortable_name\n        end\n      end\n\n      VALID_STATUSES = %w[active suspended deleted].freeze\n      private_constant :VALID_STATUSES\n","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/user_importer.rb#L89-L125","documentation":"SisImports::ImportError raised by SIS::UserImporter#infer_user_name when a CSV user row provides no usable name source whatsoever. The importer tries, in order: full_name, first_name/last_name, prior_name, sortable_name, short_name, and finally login_id. If every one of those fields is blank there is nothing to name the user with, so the row is rejected rather than creating an anonymous User.","triggerScenarios":"A users.csv row processed via SIS batch import (process_batch -> new_user -> infer_user_name) where full_name, first_name, last_name, sortable_name, short_name, and login_id are all absent or empty strings. This happens for a brand-new user (no prior_name to inherit) with a login_id column that is empty or whitespace.","commonSituations":"Hand-edited or partially filled CSV templates where a row has only user_id and status filled in; downstream scripts that strip empty columns; export tools that write blank login_id when the authentication is external; renaming flows that removed the name columns while creating genuinely new users.","solutions":["Add a full_name (or first_name/last_name) value to the offending CSV row; check user_row.user_id in the import error report to find it","Ensure login_id is populated for the row — the importer falls back to it as the display name","If updating an existing user, keep the name columns or rely on prior_name: do not blank them out on re-import","Pre-validate the CSV before upload: reject rows where all name fields and login_id are blank"],"exampleFix":"// before (users.csv row)\nuser_id,status\n1001,active\n\n// after\nuser_id,full_name,status\n1001,Jane Doe,active","handlingStrategy":"validation","validationCode":"def row_has_name?(row)\n  [row[:full_name], row[:first_name], row[:last_name],\n   row[:sortable_name], row[:short_name], row[:login_id]]\n    .any? { |v| v.is_a?(String) && v.strip.present? }\nend\nraise 'row missing all name fields' unless row_has_name?(csv_row)","typeGuard":"def present_str?(v) = v.is_a?(String) && !v.strip.empty?","tryCatchPattern":"begin\n  importer.process_batch\nrescue SisImports::ImportError => e\n  next if e.message == 'No name given for user'\n  raise\nend","preventionTips":["Require full_name or login_id in every generated users.csv row","Lint CSVs for blank name/login columns before submitting a SIS batch","Never emit rows containing only user_id and status"],"tags":["sis-import","csv-validation","ruby","missing-data"],"backgroundTag":"empty-required-field","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"}