instructure/canvas-lms · error · ImportError

No sis_id given for a #

Error message

No sis_id given for a #{type_display}

What it means

GroupCategoryImporter.invalid_category? raises ImportError when the sis_id of a group category (or differentiation tag set, via type_display) is blank. Called from add_group_category and add_differentiation_tag_set, it validates that every category row carries an identifier.

Solutions

  1. Populate the sis_id column in the group categories CSV
  2. Fix header mapping so the sis_id is parsed and passed first to invalid_category?
  3. Skip or repair rows with blank ids in preprocessing
  4. For programmatic calls, pass a non-blank sis_id string

Example fix

// before
importer.add_group_category(account, row['id'], row['name'], row['status'])
// after
next if row['id'].blank?
importer.add_group_category(account, row['id'], row['name'], row['status'])
Defensive patterns

Strategy: validation

Validate before calling

raise 'missing sis_id' if sis_id.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

When it happens

Trigger: Adding a group category with nil/empty sis_id — e.g. a group_categories CSV row missing the group_category_id/sis_id column, or `add_group_category(account, nil, name, status)`.

Common situations: CSV headers not matching so the id column parses as nil; export omitted ids for auto-created categories; hand-written scripts constructing categories without a sis_id.

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


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

Appendix: source

Thrown at lib/sis/group_category_importer.rb:45

      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)