instructure/canvas-lms · error · ImportError

Invalid status # for admin

Error message

Invalid status #{status} for admin

What it means

Raised by SIS::AdminImporter#process_admin when the `status` value, after downcase/strip, is not one of the accepted states `active` or `deleted`. The importer only supports these two admin lifecycle states.

Solutions

  1. Change the status value to exactly `active` or `deleted` (case/whitespace insensitive).
  2. Map your source system's status vocabulary to Canvas's active/deleted before import.
  3. Validate the status column against the allowed set before running the SIS import.

Example fix

// before
process_admin(user_id: 'u1', account_id: 'a1', role: 'AccountAdmin', status: 'inactive')
// after
process_admin(user_id: 'u1', account_id: 'a1', role: 'AccountAdmin', status: 'deleted')
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = %w[active deleted]
normalized = status.to_s.downcase.strip
raise ArgumentError, "invalid status #{normalized}" unless ALLOWED.include?(normalized)

Try / catch

begin
  importer.process_admin(user_id:, account_id:, role:, status:)
rescue SIS::ImportError => e
  logger.warn("admin row skipped: #{e.message}")
end

Prevention

When it happens

Trigger: status: 'Active ' is fine after strip, but status: 'actve', 'deactivated', 'inactive', 'pending', or a localized value will fail.

Common situations: Export from another SIS tool using different status vocabulary ('enabled'/'disabled'); typos in hand-edited CSVs; case-sensitive assumptions removed since casing/whitespace are normalized but spelling is not.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at lib/sis/admin_importer.rb:68

      def initialize(batch, root_account, logger)
        @batch = batch
        @root_account = root_account
        @account = root_account
        @logger = logger
        @success_count = 0
        @roll_back_data = []
        @account_users_to_update_associations = Set.new
        @account_users_to_set_batch_id = Set.new
        @account_roles_by_account_id = {}
      end

      def process_admin(user_id: nil, account_id: nil, role_id: nil, role: nil, status: nil, root_account: nil)
        raise ImportError, "No user_id given for admin" if user_id.blank?
        raise ImportError, "No status given for admin" if status.blank?
        raise ImportError, "No role_id or role given for admin" if role.blank? && role_id.blank?

        state = status.downcase.strip
        raise ImportError, "Invalid status #{status} for admin" unless %w[active deleted].include? state
        return if @batch.skip_deletes? && state == "deleted"

        get_account(account_id)
        raise ImportError, "Invalid account_id given for admin" unless @account

        get_role(role_id, role)
        raise ImportError, "Invalid role '#{role}' for admin" if role.present? && !@role
        raise ImportError, "Invalid role_id '#{role_id}' for admin" if role_id.present? && !@role

        the_root_account = root_account_from_id(root_account) if root_account
        raise ImportError, "Invalid or unknown user_id '#{user_id}' for admin" if root_account && !the_root_account

        the_root_account ||= @root_account

        user = get_user(user_id, the_root_account)
        raise ImportError, "Invalid or unknown user_id '#{user_id}' for admin" unless user

        if state == "deleted" && user.id == @batch&.user_id && @account == @root_account

View on GitHub (pinned to 1c9f0bb801)