instructure/canvas-lms · error · ImportError
No status given for admin
Error message
No status given for admin
What it means
SIS CSV admin import validation in SIS::AdminImporter#process_admin. It raises ImportError when a row defines an admin (user/account/role) but the `status` column is blank. The importer needs an explicit state to know whether to activate or delete the admin membership.
Solutions
- Add a `status` value of `active` or `deleted` to the admin row / pass status: to process_admin.
- Validate the CSV before import (check required headers user_id, account_id, role, status and non-blank status values).
- If the record is intended as a no-op, remove the row entirely rather than leaving status blank.
Example fix
// before process_admin(user_id: 'u1', account_id: 'a1', role: 'AccountAdmin') // after process_admin(user_id: 'u1', account_id: 'a1', role: 'AccountAdmin', status: 'active')
Defensive patterns
Strategy: validation
Validate before calling
raise ArgumentError, 'status is required for admin' if status.blank? unless %w[active deleted].include?(status.to_s.downcase.strip) raise ArgumentError, "status must be 'active' or 'deleted'" end
Try / catch
begin
importer.process_admin(user_id:, account_id:, role:, status:)
rescue SIS::ImportError => e
errors << { row: row_no, message: e.message }
end Prevention
- Validate CSV headers and required non-blank columns (user_id, account_id, role/role_id, status) before upload.
- Keep a canonical admin CSV template with all required columns.
- Add integration tests for admin import rows with missing fields.
When it happens
Trigger: Calling process_admin(user_id:, account_id:, role_id:/role:, root_account:) without passing status, or an admin CSV row whose `status` column is empty.
Common situations: Hand-edited SIS admin CSVs missing the status column; CSV parsers dropping empty columns; custom scripts calling the importer API directly and forgetting the keyword argument; templates that omit status for header-only files.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No role_id or role given for admin
- Improper status "# " for # # .
- Invalid account_id given for admin
- Invalid status # for admin
- No institutional_tag_id given for an institutional tag
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/266bb99dd5d0634d.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/admin_importer.rb:64
:roll_back_data,
:account_users_to_update_associations,
:account_users_to_set_batch_id
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
View on GitHub (pinned to 1c9f0bb801)