instructure/canvas-lms · error · GraphQL::ExecutionError

feature flag is disabled

Error message

feature flag is disabled

What it means

This GraphQL mutation error means the `institutional_tags` feature flag is not enabled on the domain root account, so ApplyInstitutionalTag.resolve refuses to run before checking anything else. Canvas gates institutional tag management behind an account-level feature flag; the mutation raises GraphQL::ExecutionError immediately when the flag is off.

Solutions

  1. Enable the feature flag on the domain root account: in Rails console run `root_account.set_feature_flag!` or via Account UI Settings > Feature Options > Institutional Tags.
  2. If testing, wrap the spec/request in `Account.site_admin.enable_feature!(...)` or stub `feature_enabled?(:institutional_tags)` to return true.
  3. Verify context[:domain_root_account] is the account you think it is (shard/sub-account mismatch).
  4. Check that the mutation is being sent against the intended Canvas environment (prod vs test accounts have separate flag settings).

Example fix

// before (client): mutation fails with 'feature flag is disabled'
applyInstitutionalTag(input: { tagId: 1, userId: 2 })

// after (server setup): enable the flag first
Account.find(root_account_id).enable_feature!(:institutional_tags)
Defensive patterns

Strategy: validation

Validate before calling

# before calling the mutation
acct = context[:domain_root_account]
raise 'flag off' unless acct.feature_enabled?(:institutional_tags)

Type guard

def flag_enabled?(account, flag)
  account.respond_to?(:feature_enabled?) && account.feature_enabled?(flag)
end

Try / catch

begin
  result = canvas_graphql.mutation(APPLY_TAG, vars)
rescue GraphQL::ExecutionError => e
  retry_after_enabling_flag if e.message == 'feature flag is disabled'
end

Prevention

When it happens

Trigger: Calling the applyInstitutionalTag GraphQL mutation on an account where root_account.feature_enabled?(:institutional_tags) returns false (flag never enabled, enabled only at a sub-account, or enabled in a different environment).

Common situations: Dev/test environments where the flag was never turned on; calling against a shard/account different from the one where the flag was enabled; flag enabled only for a site admin account rather than the domain root account; forgetting `Account.site_admin.feature_owners` / enable_feature_flag setup in specs.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/apply_institutional_tag.rb:38

# NOTE: Depends on InstitutionalTag, InstitutionalTagAssociation models

module Mutations
  class ApplyInstitutionalTag < BaseMutation
    argument :tag_id,
             ID,
             required: true,
             prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("InstitutionalTag")
    argument :user_id,
             ID,
             required: true,
             prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func("User")

    field :institutional_tag_association, Types::InstitutionalTagAssociationType, null: true

    def resolve(input:) # rubocop:disable GraphQL/UnusedArgument
      root_account = context[:domain_root_account]
      raise GraphQL::ExecutionError, "feature flag is disabled" unless root_account.feature_enabled?(:institutional_tags)
      raise GraphQL::ExecutionError, "not authorized" unless root_account.grants_right?(current_user, session, :manage_institutional_tags_edit)

      tag = InstitutionalTag.where(root_account_id: root_account.id, workflow_state: "active").find_by(id: input[:tag_id])
      raise GraphQL::ExecutionError, "not found" unless tag

      user = root_account.all_users.find_by(id: input[:user_id])
      raise GraphQL::ExecutionError, "not found" unless user

      assoc = InstitutionalTagAssociation.find_or_initialize_by(
        institutional_tag: tag,
        context: user,
        root_account:
      )
      assoc.workflow_state = "active"

      if assoc.save
        { institutional_tag_association: assoc }
      else

View on GitHub (pinned to 1c9f0bb801)