instructure/canvas-lms · error · ImportError

Differentiation Tags are not enabled for Account #

Error message

Differentiation Tags are not enabled for Account #{context.account.id}.

What it means

add_differentiation_tag_set requires the 'Assign to Differentiation Tags' feature (allow_assign_to_differentiation_tags?) to be enabled on the owning account. When the resolved context's account has the feature off, the importer raises ImportError rather than creating tag sets for a disabled feature.

Solutions

  1. Enable the differentiation tags feature flag on the target account (account settings / feature flags).
  2. Remove differentiation_tag_sets.csv rows from the import bundle if the feature should stay off.
  3. Point the import at a course under an account where the feature is enabled.

Example fix

// before (account flag off)
# rails console
account.allow_assign_to_differentiation_tags? # => false
// after
account.update!(allow_assign_to_differentiation_tags: true)
Defensive patterns

Strategy: validation

Validate before calling

unless context.account.allow_assign_to_differentiation_tags?
  raise ArgumentError, "differentiation tags disabled for account #{context.account.id}"
end

Try / catch

begin
  importer.add_differentiation_tag_set(sis_id, course_id, name, status)
rescue SIS::GroupCategoryImporter::ImportError => e
  if e.message =~ /Differentiation Tags are not enabled/ then skip_bundle_section
  else raise end
end

Prevention

When it happens

Trigger: add_differentiation_tag_set imports (differentiation_tag_sets.csv rows) into a course whose root/owning account has allow_assign_to_differentiation_tags? == false — i.e., the differentiation tags feature flag is disabled at the account level.

Common situations: Copying an import bundle from an instance/account with differentiation tags enabled to one where it's off; account admins turning the feature off while scheduled SIS jobs still emit tag-set rows; sub-accounts with differing flag states.

Related errors


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

Appendix: source

Thrown at lib/sis/group_category_importer.rb:136

        check_context_movement(gc, context, sis_id, "group category")

        gc ||= context.group_categories.new
        gc.name = category_name
        gc.context = context
        gc.root_account_id = @root_account.id
        gc.sis_source_id = sis_id
        gc.sis_batch_id = @batch.id

        apply_status(gc, status)
        save_category(gc, sis_id, "group category")
      end

      def add_differentiation_tag_set(sis_id, course_id, set_name, status)
        return if invalid_category?(sis_id, set_name, status, "differentiation tag set")

        context = find_context(nil, course_id, sis_id, "differentiation tag set")
        raise ImportError, "Differentiation Tags are not enabled for Account #{context.account.id}." unless context.account.allow_assign_to_differentiation_tags?

        tag_set = @root_account.all_differentiation_tag_categories.find_by(sis_source_id: sis_id)

        check_context_movement(tag_set, context, sis_id, "differentiation tag set")

        tag_set ||= context.differentiation_tag_categories.new
        tag_set.name = set_name
        tag_set.context = context
        tag_set.root_account_id = @root_account.id
        tag_set.sis_source_id = sis_id
        tag_set.non_collaborative = true
        tag_set.sis_batch_id = @batch.id

        apply_status(tag_set, status)
        save_category(tag_set, sis_id, "differentiation tag set")
      end

      def build_data(category)

View on GitHub (pinned to 1c9f0bb801)