{"record":{"id":"5a1518a63bbb58e3","repo":"instructure/canvas-lms","slug":"feature-flag-is-disabled-update-institutional-tag-category","errorCode":null,"errorMessage":"feature flag is disabled","messagePattern":"feature flag is disabled","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/update_institutional_tag_category.rb","lineNumber":36,"sourceCode":"# with this program. If not, see <http://www.gnu.org/licenses/>.\n#\n\n# NOTE: Depends on InstitutionalTagCategory model (app/models/institutional_tag_category.rb)\n\nmodule Mutations\n  class UpdateInstitutionalTagCategory < BaseMutation\n    argument :description, String, required: false\n    argument :id,\n             ID,\n             required: true,\n             prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func(\"InstitutionalTagCategory\")\n    argument :name, String, required: false\n\n    field :institutional_tag_category, Types::InstitutionalTagCategoryType, null: true\n\n    def resolve(input:)\n      root_account = context[:domain_root_account]\n      raise GraphQL::ExecutionError, \"feature flag is disabled\" unless root_account.feature_enabled?(:institutional_tags)\n      raise GraphQL::ExecutionError, \"not authorized\" unless root_account.grants_right?(current_user, session, :manage_institutional_tags_edit)\n\n      category = root_account.institutional_tag_categories.where(workflow_state: \"active\").find_by(id: input[:id])\n      raise GraphQL::ExecutionError, \"not found\" unless category\n\n      attrs = {}\n      attrs[:name] = input[:name] if input.key?(:name)\n      attrs[:description] = input[:description] if input.key?(:description)\n\n      if category.update(attrs)\n        { institutional_tag_category: category }\n      else\n        errors_for(category)\n      end\n    rescue ActiveRecord::RecordInvalid\n      errors_for(category)\n    rescue ActiveRecord::RecordNotFound\n      raise GraphQL::ExecutionError, \"not found\"","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/update_institutional_tag_category.rb#L18-L54","documentation":"The updateInstitutionalTagCategory mutation raises this GraphQL::ExecutionError when the :institutional_tags feature flag is not enabled on the domain root account. Canvas gates institutional tag functionality behind this root-account feature flag, and the mutation refuses to run without it. It is an intentional guard, not a bug.","triggerScenarios":"Calling updateInstitutionalTagCategory on an account where root_account.feature_enabled?(:institutional_tags) returns false — the flag was never enabled, was disabled after being on, or the request resolves to a root account (e.g. via domain) that lacks the flag.","commonSituations":"Testing against a local/dev account where the flag is off, a Canvas instance or shard where institutional_tags hasn't been rolled out, or a request hitting the wrong domain root account due to hostname configuration.","solutions":["Enable the flag: in a Rails console run Account.find(<root_account_id>).enable_feature!(:institutional_tags) or via the account Settings > Feature Options UI.","Confirm you are hitting the correct Canvas domain so context[:domain_root_account] is the intended account.","If the flag should be on but isn't, check account-level vs site-admin flag inheritance and any environment-specific flag settings."],"exampleFix":"// Rails console\n# before: flag off\n# after\naccount = Account.default\naccount.enable_feature!(:institutional_tags)","handlingStrategy":"validation","validationCode":"// Rails console pre-check\nraise 'flag off' unless root_account.feature_enabled?(:institutional_tags)\n// client-side: read flag state via account.featureFlags query before calling","typeGuard":"function canMutate(account) { return account?.featureFlags?.some(f => f.flag === 'institutional_tags' && f.state === 'allowed') ?? false }","tryCatchPattern":null,"preventionTips":["Enable institutional_tags in every environment where the UI/tooling will run","Check flag state before rendering dependent UI","Ensure the request domain maps to the intended root account","Document flag dependencies for GraphQL tooling"],"tags":["graphql","feature-flag","authorization"],"backgroundTag":"feature-not-enabled","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"}