{"record":{"id":"f905ad73894c1cde","repo":"instructure/canvas-lms","slug":"custom-gradebook-statuses-feature-flag-is-disabled-upsert","errorCode":null,"errorMessage":"custom gradebook statuses feature flag is disabled","messagePattern":"custom gradebook statuses feature flag is disabled","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/upsert_custom_grade_status.rb","lineNumber":28,"sourceCode":"# Software Foundation, version 3 of the License.\n#\n# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY\n# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR\n# 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#\nmodule Mutations\n  class UpsertCustomGradeStatus < BaseMutation\n    argument :color, String, required: true\n    argument :id, ID, required: false\n    argument :name, String, required: true\n    field :custom_grade_status, Types::CustomGradeStatusType, null: true\n\n    def resolve(input:)\n      raise GraphQL::ExecutionError, \"custom gradebook statuses feature flag is disabled\" unless Account.site_admin.feature_enabled?(:custom_gradebook_statuses)\n\n      root_account = context[:domain_root_account]\n      custom_grade_status = input[:id] ? root_account.custom_grade_statuses.active.find(input[:id]) : CustomGradeStatus.new(root_account:, created_by: current_user)\n\n      required_permission = custom_grade_status.new_record? ? :create : :update\n      unless custom_grade_status.grants_right?(current_user, session, required_permission)\n        raise GraphQL::ExecutionError, I18n.t(\"Insufficient permissions\")\n      end\n\n      if custom_grade_status.new_record?\n        InstStatsd::Statsd.distributed_increment(\"custom_grade_status.graphql.create\")\n      else\n        InstStatsd::Statsd.distributed_increment(\"custom_grade_status.graphql.update\")\n      end\n\n      if custom_grade_status.update(name: input[:name], color: input[:color])\n        { custom_grade_status: }\n      else","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/upsert_custom_grade_status.rb#L10-L46","documentation":"The UpsertCustomGradeStatus GraphQL mutation is gated behind the :custom_gradebook_statuses feature flag on Account.site_admin. resolve checks the flag first and raises this GraphQL::ExecutionError when the flag is off, refusing to create or update custom gradebook statuses.","triggerScenarios":"Calling the upsertCustomGradeStatus mutation in any account/shard where Account.site_admin.feature_enabled?(:custom_gradebook_statuses) is false.","commonSituations":"Testing the mutation in a development or staging environment before the flag is enabled; production rollout not yet complete; flag enabled only for some root accounts but the check is site-admin level.","solutions":["Enable the feature flag: in a Rails console run Account.site_admin.enable_feature! :custom_gradebook_statuses (or via the site admin feature settings UI)","Verify the flag state with Account.site_admin.feature_enabled?(:custom_gradebook_statuses)","If the feature should not be used, stop calling the mutation and use standard gradebook statuses"],"exampleFix":"// before (Rails console)\n# flag off, mutation fails\n// after\nAccount.site_admin.enable_feature! :custom_gradebook_statuses\nAccount.site_admin.feature_enabled?(:custom_gradebook_statuses) # => true","handlingStrategy":"try-catch","validationCode":"// Rails console\nAccount.site_admin.feature_enabled?(:custom_gradebook_statuses) # must be true before calling the mutation","typeGuard":null,"tryCatchPattern":"try {\n  await upsertCustomGradeStatus(input);\n} catch (e) {\n  if (e.message.includes(\"feature flag is disabled\")) {\n    notifyAdminToEnableFlag(\"custom_gradebook_statuses\");\n  }\n}","preventionTips":["Check the flag in the target environment before shipping UI that calls this mutation","Document flag dependencies for GraphQL-backed features","Use the feature-flag state from the environment query to hide the UI entry point"],"tags":["graphql","feature-flag","permissions"],"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"}