{"record":{"id":"6cee3da3e2568edf","repo":"instructure/canvas-lms","slug":"no-sis-id-given-for-a-type-display","errorCode":null,"errorMessage":"No sis_id given for a #{type_display}","messagePattern":"No sis_id given for a #(.+?)","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/group_category_importer.rb","lineNumber":45,"sourceCode":"\n      importer.success_count\n    end\n\n    class Work\n      attr_accessor :success_count, :roll_back_data\n\n      def initialize(batch, root_account, logger)\n        @batch = batch\n        @root_account = root_account\n        @logger = logger\n        @success_count = 0\n        @roll_back_data = []\n        @accounts_cache = {}\n        @courses_cache = {}\n      end\n\n      def invalid_category?(sis_id, name, status, type_display)\n        raise ImportError, \"No sis_id given for a #{type_display}\" if sis_id.blank?\n        raise ImportError, \"No name given for #{type_display} #{sis_id}\" if name.blank?\n        raise ImportError, \"No status given for #{type_display} #{sis_id}\" if status.blank?\n        raise ImportError, \"Improper status \\\"#{status}\\\" for #{type_display} #{sis_id}, skipping\" unless /\\A(active|deleted)/i.match?(status)\n        return true if @batch.skip_deletes? && status =~ /deleted/i\n\n        false\n      end\n\n      def find_context(account_id, course_id, sis_id, type_display)\n        context = nil\n        if account_id && course_id\n          raise ImportError, \"Only one context is allowed and both course_id and account_id where provided for #{type_display} #{sis_id}.\"\n        end\n\n        if account_id\n          context = @accounts_cache[account_id]\n          context ||= @root_account.all_accounts.active.find_by(sis_source_id: account_id)\n          raise ImportError, \"Account with id \\\"#{account_id}\\\" didn't exist for #{type_display} #{sis_id}\" unless context","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/group_category_importer.rb#L27-L63","documentation":"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.","triggerScenarios":"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)`.","commonSituations":"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.","solutions":["Populate the sis_id column in the group categories CSV","Fix header mapping so the sis_id is parsed and passed first to invalid_category?","Skip or repair rows with blank ids in preprocessing","For programmatic calls, pass a non-blank sis_id string"],"exampleFix":"// before\nimporter.add_group_category(account, row['id'], row['name'], row['status'])\n// after\nnext if row['id'].blank?\nimporter.add_group_category(account, row['id'], row['name'], row['status'])","handlingStrategy":"validation","validationCode":"raise 'missing sis_id' if sis_id.blank?\nimporter.add_group_category(account, sis_id, name, status)","typeGuard":null,"tryCatchPattern":"begin\n  importer.add_group_category(account, sis_id, name, status)\nrescue SIS::Base::ImportError => e\n  logger.warn(\"Skipping category: #{e.message}\")\nend","preventionTips":["Require the id column in group category exports","Validate headers before import","Skip and log rows with blank ids in preprocessing"],"tags":["ruby","sis-import","group-category","missing-identifier"],"backgroundTag":"missing-required-argument","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}