instructure/canvas-lms · error · ImportError

No name given for # # .

Error message

No name given for #{type_display_name(type)} #{id}.

What it means

Raised during a SIS import when a group or differentiation tag row supplies no name. GroupImporter requires every imported item to have a non-blank name because the Group/GroupCategory models validate name presence, so the importer fails fast with a row-specific message instead of a model validation error. The message includes the humanized type and the supplied id.

Solutions

  1. Add a non-blank value to the 'name' column for the row with the given id.
  2. Remove the row if it is not meant to be imported.
  3. Trim or supply real names if values are whitespace-only.
  4. Validate name presence before calling add_group/add_tag programmatically.

Example fix

# before
group_id,course_id,name,status
G101,C200,,available
# after
group_id,course_id,name,status
G101,C200,Study Group A,available
Defensive patterns

Strategy: validation

Validate before calling

raise ArgumentError, 'name is required for SIS group row' if name.to_s.strip.empty?

Try / catch

begin
  importer.add_group(gid, cat_id, acct_id, course_id, name, status)
rescue ImportError => e
  logger.warn("Row skipped: #{e.message}")
end

Prevention

When it happens

Trigger: add_group or add_tag called with a blank/nil name — a CSV row in the groups/tags file whose 'name' column is empty or whitespace, or nil passed programmatically.

Common situations: Exports from external systems emitting optional columns as empty strings; hand-edited CSVs with missing name cells; generators omitting trailing empty fields; leftover template 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


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

Appendix: source

Thrown at lib/sis/group_importer.rb:54

      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

      private

      def type_display_name(type)
        type.tr("_", " ")
      end

      def invalid_import_item?(id, name, status, type)
        raise ImportError, "No #{(type == "group") ? type : "tag"}_id given for a #{type_display_name(type)}." unless id
        raise ImportError, "No name given for #{type_display_name(type)} #{id}." if name.blank?
        raise ImportError, "Improper status \"#{status}\" for #{type_display_name(type)} #{id}." unless /\A(available|closed|completed|deleted)/i.match?(status)
        return true if @batch.skip_deletes? && status =~ /deleted/i

        false
      end

      def find_context(id, id_type, type, item_id)
        context = nil
        cache = (id_type == :course_id) ? @courses_cache : @accounts_cache

        if id
          context = cache[id]
          context ||= if id_type == :course_id
                        @root_account.all_courses.active.find_by(sis_source_id: id)
                      else
                        @root_account.all_accounts.active.find_by(sis_source_id: id)
                      end

View on GitHub (pinned to 1c9f0bb801)