{"record":{"id":"193f53be5c03af19","repo":"instructure/canvas-lms","slug":"feature-flag-is-disabled-create-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/create_institutional_tag_category.rb","lineNumber":32,"sourceCode":"# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more\n# details.\n#\n# You should have received a copy of the GNU Affero General Public License along\n# 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 CreateInstitutionalTagCategory < BaseMutation\n    argument :description, String, required: false\n    argument :name,        String, required: true\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_create)\n\n      category = root_account.institutional_tag_categories.new(\n        name: input[:name],\n        description: input[:description]\n      )\n\n      if category.save\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\"\n    end\n  end","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/create_institutional_tag_category.rb#L14-L50","documentation":"CreateInstitutionalTagCategory gates the mutation on the institutional_tags feature flag of the domain root account. When the flag is disabled it raises this GraphQL::ExecutionError before authorization or any model work. Same flag family as the CreateInstitutionalTag gate.","triggerScenarios":"createInstitutionalTagCategory called on an account where feature_enabled?(:institutional_tags) is false — flag never enabled, environment without rollout, or wrong root account resolved in context.","commonSituations":"Local development without enabling the FF; calling on beta/production before rollout; multi-account setups where only some root accounts have the flag; flag rolled back by a release toggle.","solutions":["Enable institutional_tags on the root account via Account feature options or console (set_feature_flag!('institutional_tags', 'on')).","Confirm context[:domain_root_account] is the flagged account.","Check flag environment/site-level overrides that may disable it in that environment.","Clear/refresh feature-flag caches if enabling appears not to take effect."],"exampleFix":"// before\nroot_account.feature_enabled?(:institutional_tags) # => false\n// after\nAccount.default.set_feature_flag!('institutional_tags', 'on') # then retry","handlingStrategy":"validation","validationCode":"# pre-flight\nraise 'flag disabled' unless root_account.feature_enabled?(:institutional_tags)","typeGuard":"function canCreateTagCategory(account) {\n  return Boolean(account && account.featureFlags && account.featureFlags.includes('institutional_tags'));\n}","tryCatchPattern":"try {\n  await createInstitutionalTagCategory({ variables })\n} catch (e) {\n  if (e.message === 'feature flag is disabled') {\n    // show 'enable institutional tags' guidance instead of retrying\n  }\n}","preventionTips":["Enable institutional_tags before testing category creation","Check featureFlags in UI before rendering category-management screens","Enable the flag on the domain root account (sub-account flags don't count)","Keep flag state documented per environment"],"tags":["graphql","feature-flag","canvas","configuration"],"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"}