{"record":{"id":"7c2465a18060dec9","repo":"instructure/canvas-lms","slug":"feature-flag-is-disabled-update-institutional-tag","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.rb","lineNumber":40,"sourceCode":"\nmodule Mutations\n  class UpdateInstitutionalTag < BaseMutation\n    argument :category_id,\n             ID,\n             required: false,\n             prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func(\"InstitutionalTagCategory\")\n    argument :description, String, required: false\n    argument :id,\n             ID,\n             required: true,\n             prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func(\"InstitutionalTag\")\n    argument :name, String, required: false\n\n    field :institutional_tag, Types::InstitutionalTagType, 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      tag = InstitutionalTag.where(root_account_id: root_account.id, workflow_state: \"active\").find_by(id: input[:id])\n      raise GraphQL::ExecutionError, \"not found\" unless tag\n\n      attrs = {}\n      attrs[:name] = input[:name] if input.key?(:name)\n      attrs[:description] = input[:description] if input.key?(:description)\n\n      if input.key?(:category_id)\n        category = root_account.institutional_tag_categories.where(workflow_state: \"active\").find_by(id: input[:category_id])\n        raise GraphQL::ExecutionError, \"not found\" unless category\n\n        attrs[:category_id] = category.id\n      end\n\n      if tag.update(attrs)\n        { institutional_tag: tag }","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/update_institutional_tag.rb#L22-L58","documentation":"The updateInstitutionalTag mutation checks that the domain root account has the :institutional_tags feature enabled before doing anything else. If the flag is off, it raises GraphQL::ExecutionError \"feature flag is disabled\" regardless of arguments, so the mutation is a no-op that surfaces in the GraphQL errors array.","triggerScenarios":"Calling updateInstitutionalTag on an account where the institutional_tags feature flag has never been enabled, or after the flag was turned off, or when context[:domain_root_account] points at an account without the flag while the tag was created on another account that had it.","commonSituations":"Deploying code that depends on institutional tags to an environment (test/beta/production) where the flag was not rolled out; a client environment pointing at the wrong account; flag cleaned up after being made obsolete.","solutions":["Enable the flag on the root account: Account.site_admin.set_feature_flag or account.feature_flags enable 'institutional_tags' (Rails console).","Verify the request targets the intended domain/root account (check Host header / domain root account resolution).","Confirm the flag still exists in config/feature_flags and is not hidden/off by default.","Gate the client UI behind the same feature so the mutation is not called when disabled."],"exampleFix":"// before\nmutation { updateInstitutionalTag(input: { id: \"...\", name: \"x\" }) { ... } }\n// after\n// first check the flag via Rails console\nroot_account.feature_enabled?(:institutional_tags) # => true before calling the mutation","handlingStrategy":"validation","validationCode":"// check flag availability before invoking\nconst flags = await fetchAccountFeatureFlags(rootAccountId)\nif (!flags.includes('institutional_tags')) throw new Error('institutional_tags disabled on this account')","typeGuard":null,"tryCatchPattern":"try {\n  await updateInstitutionalTag(input)\n} catch (e) {\n  if (e.graphQLErrors?.some(g => g.message === 'feature flag is disabled')) {\n    showFeatureDisabledNotice()\n  } else { throw e }\n}","preventionTips":["Enable the institutional_tags flag in every environment the client targets.","Gate all institutional-tag UI on the flag status, not on code availability.","Keep dev/stage/prod flag configuration in sync via provisioning scripts."],"tags":["graphql","feature-flag","canvas-lms","ruby"],"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"}