{"record":{"id":"1ef77ca456281c31","repo":"instructure/canvas-lms","slug":"no-course-id-given-for-type-display-sis-id","errorCode":null,"errorMessage":"No course_id given for #{type_display} #{sis_id}","messagePattern":"No course_id given for #(.+?) #(.+?)","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/group_category_importer.rb","lineNumber":75,"sourceCode":"          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\n\n          @accounts_cache[context.sis_source_id] = context\n        end\n\n        if course_id\n          context = @courses_cache[course_id]\n          context ||= @root_account.all_courses.active.find_by(sis_source_id: course_id)\n          raise ImportError, \"Course with id \\\"#{course_id}\\\" didn't exist for #{type_display} #{sis_id}\" unless context\n\n          @courses_cache[context.sis_source_id] = context\n        elsif course_id.nil? && type_display == \"differentiation tag set\"\n          raise ImportError, \"No course_id given for #{type_display} #{sis_id}\"\n        end\n\n        context || @root_account\n      end\n\n      def check_context_movement(category, context, sis_id, type_display)\n        if category && category.groups.active.exists? &&\n           !(context.id == category.context_id && context.class.base_class.name == category.context_type)\n\n          item_type = type_display.include?(\"tag\") ? \"tags\" : \"groups\"\n\n          raise ImportError, \"Cannot move #{type_display} #{sis_id} because it has #{item_type} in it.\"\n        end\n      end\n\n      def apply_status(category, status)\n        case status\n        when /active/i","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/group_category_importer.rb#L57-L93","documentation":"Differentiation tag sets are always course-scoped. In find_context, when course_id is nil and type_display is 'differentiation tag set', the importer raises ImportError because there is no valid context (it cannot fall back to the root account) for a tag set.","triggerScenarios":"add_differentiation_tag_set(sis_id, nil, set_name, status) — i.e., a differentiation_tag_sets CSV row with a blank course_id column. add_group_category is unaffected because its type_display differs.","commonSituations":"Account-level export scripts reusing a group-category CSV template (which allows account_id) for tag sets; users assuming tag sets, like group categories, can live at the account level.","solutions":["Always populate course_id for differentiation tag set rows.","Do not set account_id as a substitute — find_context is called with nil account_id for tag sets, so the value would be ignored and this error still raised.","Split account-level group categories into a separate group_categorys.csv import."],"exampleFix":"// before\ndts-1,My Tag Set,,active  # course_id blank\n// after\ndts-1,My Tag Set,COURSE-42,active","handlingStrategy":"validation","validationCode":"if row_type == 'differentiation tag set' && course_id.blank?\n  raise ArgumentError, 'differentiation tag set rows require course_id'\nend","typeGuard":null,"tryCatchPattern":"begin\n  importer.add_differentiation_tag_set(sis_id, course_id, name, status)\nrescue SIS::GroupCategoryImporter::ImportError => e\n  if e.message =~ /No course_id given/ then reject_row(sis_id, e.message)\n  else raise end\nend","preventionTips":["Never reuse account-level group-category CSV templates for tag sets","Enforce non-null course_id in the export for tag set records","Remember account_id is not accepted as a fallback for tag sets"],"tags":["sis","csv-import","differentiation-tags","missing-field"],"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"}