{"record":{"id":"ed28a84345c8a1f1","repo":"instructure/canvas-lms","slug":"improper-status-status-for-institutional-tag-category-sis-id","errorCode":null,"errorMessage":"Improper status \"#{status}\" for institutional tag category #{sis_id}","messagePattern":"Improper status \"#(.+?)\" for institutional tag category #(.+?)","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/institutional_tag_category_importer.rb","lineNumber":45,"sourceCode":"      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      end\n\n      def add_institutional_tag_category(sis_id, name, description, status)\n        raise ImportError, \"No category_id given for an institutional tag category\" if sis_id.blank?\n        raise ImportError, \"No name given for institutional tag category #{sis_id}\" if name.blank?\n        raise ImportError, \"No status given for institutional tag category #{sis_id}\" if status.blank?\n        raise ImportError, \"Improper status \\\"#{status}\\\" for institutional tag category #{sis_id}\" unless /\\A(active|deleted)/i.match?(status)\n        return if @batch.skip_deletes? && /deleted/i.match?(status)\n\n        category = InstitutionalTagCategory.find_by(root_account_id: @root_account.id, sis_source_id: sis_id)\n        category ||= InstitutionalTagCategory.new(account: @root_account,\n                                                  root_account: @root_account,\n                                                  sis_source_id: sis_id)\n\n        category.name = name\n        category.description = description\n        category.sis_batch_id = @batch.id\n        category.workflow_state = /deleted/i.match?(status) ? \"deleted\" : \"active\"\n\n        if category.save\n          data = SisBatchRollBackData.build_data(sis_batch: @batch, context: category)\n          @roll_back_data << data if data\n          @success_count += 1\n          maybe_write_roll_back_data\n        else","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/institutional_tag_category_importer.rb#L27-L63","documentation":"Raised by SisImports::InstitutionalTagCategoryImporter#add_institutional_tag_category when status is non-blank but does not match /\\A(active|deleted)/i. The importer accepts only 'active' or 'deleted' (case-insensitive) as lifecycle states; any other string is rejected before the record is created or updated.","triggerScenarios":"Calling add_institutional_tag_category with status like 'inactive', 'archived', 'enabled', or values with leading/trailing text that break the anchored match; CSV rows using vocabulary from a different SIS object (e.g. course 'unpublished'/'completed').","commonSituations":"Mapping an external system's status enum (enabled/disabled, A/I flags) straight into the Canvas SIS file; typos like 'actve' or 'deletd'; copying status values from course/section imports where the allowed set differs.","solutions":["Change the status value in the CSV/API call to exactly 'active' or 'deleted' (any casing).","Add a mapping step in the export pipeline translating foreign status enums to Canvas's active/deleted vocabulary.","Strip whitespace/extra text from the status field before import.","Re-run the SIS import."],"exampleFix":"// before\nadd_institutional_tag_category('cat-1', 'Department Tags', 'desc', 'inactive')\n// after\nadd_institutional_tag_category('cat-1', 'Department Tags', 'desc', 'deleted')","handlingStrategy":"validation","validationCode":"status = status.to_s.strip.downcase\nraise ArgumentError, \"invalid status #{status}\" unless %w[active deleted].include?(status)\nadd_institutional_tag_category(sis_id, name, description, status)","typeGuard":null,"tryCatchPattern":"begin\n  importer.add_institutional_tag_category(sis_id, name, description, status)\nrescue SisImports::ImportError => e\n  Rails.logger.warn(\"Bad status for category #{sis_id}: #{e.message}\")\nend","preventionTips":["Normalize foreign status enums (enabled/disabled, A/I) to active/deleted in the exporter.","Whitelist allowed values in a preprocessing step before import.","Don't reuse status vocabularies from other SIS objects (courses/sections)."],"tags":["sis-import","validation","invalid-enum","ruby"],"backgroundTag":"invalid-enum-value","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"}