{"record":{"id":"c7cdbeae384a6f5d","repo":"instructure/canvas-lms","slug":"no-status-given-for-user-user-user-id","errorCode":null,"errorMessage":"No status given for user #{user.user_id}","messagePattern":"No status given for user #(.+?)","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/user_importer.rb","lineNumber":77,"sourceCode":"        @logger = logger\n        @batched_users = []\n        @messages = messages\n        @success_count = 0\n\n        @roll_back_data = []\n        @users_to_set_sis_batch_ids = []\n        @pseudos_to_set_sis_batch_ids = []\n        @users_to_add_account_associations = []\n        @users_to_update_account_associations = []\n        @users_to_sync = Set.new\n        @authentication_providers = {}\n      end\n\n      # Pass a single instance of SIS::Models::User\n      def add_user(user, login_only: false)\n        raise ImportError, \"No user_id given for a user\" if user.user_id.blank?\n        raise ImportError, \"No login_id given for user #{user.user_id}\" if user.login_id.blank?\n        raise ImportError, \"No status given for user #{user.user_id}\" if user.status.blank?\n        raise ImportError, \"Improper status for user #{user.user_id}\" unless user.status.match?(/\\A(active|suspended|deleted)/i)\n        return if @batch.skip_deletes? && user.status.match?(/deleted/i)\n\n        if login_only && user.existing_user_id.blank? && user.existing_integration_id.blank? && user.existing_canvas_user_id.blank?\n          raise ImportError, I18n.t(\"No existing user provided for login with SIS ID %{user_id}\", user_id: user.user_id)\n        end\n\n        @batched_users << user\n        process_batch(login_only:) if @batched_users.size >= BATCH_SIZE\n      end\n\n      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","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/user_importer.rb#L59-L95","documentation":"add_user validates that user.status is present. Status (active/suspended/deleted) drives whether the user is created, deactivated, or deleted, so a blank status is ambiguous and rejected with an ImportError citing the user's user_id.","triggerScenarios":"Calling add_user with a Models::User whose status field is nil or '' — e.g. CSV rows missing the status column, or an export that omits status for new users.","commonSituations":"Hand-rolled scripts that forget to set status; SIS exports with an empty status cell; parsers that read a status column that no longer exists in the header.","solutions":["Set status explicitly ('active', 'suspended', or 'deleted') on every user record","Default missing statuses to 'active' only if that is safe for your data contract","Fix the upstream export so status is always populated","Skip and report rows with blank status instead of feeding them to add_user"],"exampleFix":"// before\nimporter.add_user(Sis::Models::User.new(user_id: id, login_id: login))\n// after\nimporter.add_user(Sis::Models::User.new(user_id: id, login_id: login, status: row['status'].presence || 'active'))","handlingStrategy":"validation","validationCode":"user.status = 'active' if user.status.blank?\nimporter.add_user(user)","typeGuard":"def has_status?(u)\n  u.is_a?(Sis::Models::User) && u.status.present?\nend","tryCatchPattern":"begin\n  importer.add_user(user)\nrescue SisImports::ImportError => e\n  Rails.logger.warn(\"user #{user.user_id}: #{e.message}\")\nend","preventionTips":["Always set a status when constructing Models::User","Document the default status policy for blank exports","Validate source files contain a status column before import"],"tags":["sis","import","status","validation"],"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"}