instructure/canvas-lms · error · ImportError
No name given for # #
Error message
No name given for #{type_display} #{sis_id} What it means
invalid_category? raises ImportError when the name of a group category or differentiation tag set is blank, even when a valid sis_id is present. The message interpolates type_display and sis_id so the offending row can be located.
Solutions
- Ensure every category row has a non-blank name column
- Fix CSV header mapping so name parses correctly
- Backfill names for categories created without one in the source system
- Guard the call site: skip rows with blank names before invoking the importer
Example fix
// before importer.add_group_category(account, row['id'], row['name'], row['status']) // after next if row['name'].blank? importer.add_group_category(account, row['id'], row['name'], row['status'])
Defensive patterns
Strategy: validation
Validate before calling
raise 'missing name' if name.blank? importer.add_group_category(account, sis_id, name, status)
Try / catch
begin
importer.add_group_category(account, sis_id, name, status)
rescue SIS::Base::ImportError => e
logger.warn("Skipping category: #{e.message}")
end Prevention
- Backfill empty names in the source system before export
- Check column alignment after any export format change
- Validate each row (sis_id + name + status) before invoking the importer
When it happens
Trigger: `invalid_category?(sis_id, nil_or_empty_name, status, type_display)` — a group_categories CSV row with a sis_id but empty name column; add_group_category/add_differentiation_tag_set called with a nil name.
Common situations: Export that leaves name empty for programmatically-created categories; column misalignment shifting names into the wrong field; translators/localization pipelines dropping the name value.
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
- No grade_publishing_status given for enrollment #
- No sis_id given for a #
- A user did not pass validation
- An email did not pass validation
- An institutional tag category did not pass validation
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/aed67dbf3ae78ac7.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/group_category_importer.rb:46
importer.success_count
end
class Work
attr_accessor :success_count, :roll_back_data
def initialize(batch, root_account, logger)
@batch = batch
@root_account = root_account
@logger = logger
@success_count = 0
@roll_back_data = []
@accounts_cache = {}
@courses_cache = {}
end
def invalid_category?(sis_id, name, status, type_display)
raise ImportError, "No sis_id given for a #{type_display}" if sis_id.blank?
raise ImportError, "No name given for #{type_display} #{sis_id}" if name.blank?
raise ImportError, "No status given for #{type_display} #{sis_id}" if status.blank?
raise ImportError, "Improper status \"#{status}\" for #{type_display} #{sis_id}, skipping" unless /\A(active|deleted)/i.match?(status)
return true if @batch.skip_deletes? && status =~ /deleted/i
false
end
def find_context(account_id, course_id, sis_id, type_display)
context = nil
if account_id && course_id
raise ImportError, "Only one context is allowed and both course_id and account_id where provided for #{type_display} #{sis_id}."
end
if account_id
context = @accounts_cache[account_id]
context ||= @root_account.all_accounts.active.find_by(sis_source_id: account_id)
raise ImportError, "Account with id \"#{account_id}\" didn't exist for #{type_display} #{sis_id}" unless context
View on GitHub (pinned to 1c9f0bb801)