instructure/canvas-lms · error · ImportError
No name given for account #
Error message
No name given for account #{account_id}, skipping What it means
When the account_id doesn't match an existing account (a brand-new sub-account will be created), the importer requires a non-blank name. If name is blank it raises ImportError. Existing accounts may be updated without a name, but new records cannot be created unnamed.
Solutions
- Provide a name for the new account row in accounts.csv.
- Check the account already exists in Canvas (then name is optional for the update path).
- Verify CSV column headers/order so the name value lands in the right field.
Example fix
// before
add_account('sub2', 'parent1', 'active', '', nil)
// after
add_account('sub2', 'parent1', 'active', 'New Sub Account', nil) Defensive patterns
Strategy: validation
Validate before calling
if new_record_required && name.to_s.strip.empty?
raise ArgumentError, "name required for new account #{account_id}"
end Try / catch
begin
importer.add_account(id, parent_id, status, name, integration_id)
rescue SIS::BaseImporter::ImportError => e
logger.warn("#{e.message}")
end Prevention
- Require non-empty name cells in accounts.csv for new accounts
- Check CSV column alignment after schema changes
- Pre-load existing sis_source_ids to know which rows are creates vs updates
When it happens
Trigger: add_account called where no account with the given sis_source_id exists under the root account AND name is nil/blank — typically an accounts.csv row with empty 'name' for a new account.
Common situations: SIS export omitting the name column for newly added accounts; CSV column misalignment shifting values; intentionally blank names for placeholder rows.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Improper status "# " for abstract course #
- Improper status "# " for # # , skipping
- No account_id given for an account
- No status given for #
- No # _id given for a # .
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/5618dbeeaeb63d2a.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/account_importer.rb:68
def add_account(account_id, parent_account_id, status, name, integration_id)
raise ImportError, "No account_id given for an account" if account_id.blank?
return if @batch.skip_deletes? && status =~ /deleted/i
parent = nil
unless parent_account_id.blank?
parent = @accounts_cache[parent_account_id]
parent ||= @root_account.all_accounts.find_by(sis_source_id: parent_account_id)
raise ImportError, "Parent account didn't exist for #{account_id}" unless parent
raise ImportError, "Cannot restore sub_account with ID: #{account_id} because parent_account with ID: #{parent_account_id} has been deleted." if parent.workflow_state == "deleted"
@accounts_cache[parent.sis_source_id] = parent
end
account = @accounts_cache[account_id]
account ||= @root_account.all_accounts.find_by(sis_source_id: account_id)
if account.nil?
raise ImportError, "No name given for account #{account_id}, skipping" if name.blank?
raise ImportError, "Improper status \"#{status}\" for account #{account_id}, skipping" unless /\A(active|deleted)/i.match?(status)
end
account ||= @root_account.sub_accounts.new
account.root_account = @root_account
if account.new_record? || !account.stuck_sis_fields.include?(:parent_account_id) || Account.sis_stickiness_options[:add_sis_stickiness]
account.parent_account = parent || @root_account
end
# only update the name on new records, and ones that haven't been changed since the last sis import
account.name = name if name.present? && (account.new_record? || !account.stuck_sis_fields.include?(:name))
account.integration_id = integration_id if integration_id.present?
account.sis_source_id = account_id
if status.present?
case statusView on GitHub (pinned to 1c9f0bb801)