{"record":{"id":"93a611b13355dca9","repo":"instructure/canvas-lms","slug":"feature-flag-is-disabled-update-institutional-tag-archived","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_archived_state.rb","lineNumber":35,"sourceCode":"# 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 InstitutionalTag and InstitutionalTagAssociation models\n\nmodule Mutations\n  class UpdateInstitutionalTagArchivedState < BaseMutation\n    argument :archived, Boolean, required: true\n    argument :id,\n             ID,\n             required: true,\n             prepare: GraphQLHelpers.relay_or_legacy_id_prepare_func(\"InstitutionalTag\")\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).find_by(id: input[:id])\n      raise GraphQL::ExecutionError, \"not found\" unless tag\n\n      input[:archived] ? tag.destroy : tag.undestroy\n\n      { institutional_tag: tag }\n    rescue ActiveRecord::RecordInvalid\n      errors_for(tag)\n    rescue ActiveRecord::RecordNotFound\n      raise GraphQL::ExecutionError, \"not found\"\n    end\n  end\nend\n","sourceCodeStart":17,"sourceCodeEnd":51,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/update_institutional_tag_archived_state.rb#L17-L51","documentation":"The updateInstitutionalTagArchivedState mutation first requires the :institutional_tags feature flag on the domain root account. If the flag is disabled, it raises GraphQL::ExecutionError \"feature flag is disabled\" before checking permissions or loading the tag.","triggerScenarios":"Calling updateInstitutionalTagArchivedState on an account where institutional_tags is off (never enabled, or turned off), or when the request resolves to a root account that lacks the flag even though the tag exists elsewhere.","commonSituations":"Flag rolled out only to some environments/accounts but clients calling it broadly; environment mismatch (beta vs production); testing an archive flow before enabling the flag locally.","solutions":["Enable the institutional_tags feature flag on the target root account (Rails console: account.enable_feature! :institutional_tags or via account feature flags UI).","Confirm which root account the request resolves to and that the flag is set there, not on a different account.","Gate the archive UI behind the same feature flag availability query.","Check config/feature_flags to ensure the flag is not marked hidden or removed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// confirm flag before archive/restore\nconst flags = await fetchAccountFeatureFlags(rootAccountId)\nif (!flags.includes('institutional_tags')) throw new Error('institutional_tags disabled')","typeGuard":null,"tryCatchPattern":"try {\n  await updateInstitutionalTagArchivedState(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 institutional_tags on all accounts where tag management UI is shown.","Check flag status via GraphQL before rendering archive/restore controls.","Keep flag state consistent across environments used by the same client build."],"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"}