{"record":{"id":"e05acbff9c0158ff","repo":"instructure/canvas-lms","slug":"custom-gradebook-statuses-feature-flag-is-disabled-e05acb","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_standard_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 UpsertStandardGradeStatus < BaseMutation\n    argument :color, String, required: true\n    argument :id, ID, required: false\n    argument :name, String, required: true\n    field :standard_grade_status, Types::StandardGradeStatusType, 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      standard_grade_status = input[:id] ? root_account.standard_grade_statuses.find_by!(id: input[:id], status_name: input[:name]) : StandardGradeStatus.new(root_account:, status_name: input[:name])\n\n      required_permission = standard_grade_status.new_record? ? :create : :update\n      unless standard_grade_status.grants_right?(current_user, session, required_permission)\n        raise GraphQL::ExecutionError, I18n.t(\"Insufficient permissions\")\n      end\n\n      if standard_grade_status.update(color: input[:color])\n        { standard_grade_status: }\n      else\n        errors_for(standard_grade_status)\n      end\n    rescue ActiveRecord::RecordNotFound\n      raise GraphQL::ExecutionError, \"standard grade status not found\"\n    end\n  end","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/upsert_standard_grade_status.rb#L10-L46","documentation":"Raised by the UpsertStandardGradeStatus mutation when the :custom_gradebook_statuses feature flag is not enabled on Account.site_admin. The mutation refuses to run at all, raising a GraphQL::ExecutionError before any permission or lookup logic executes.","triggerScenarios":"Calling upsertStandardGradeStatus (create or update by id) while the site-admin account feature flag custom_gradebook_statuses is disabled for the current context.","commonSituations":"Testing against a Canvas instance where the feature was never enabled; flag enabled on one environment but not another; UI shipped before the flag was turned on; flag rolled back after an incident.","solutions":["Enable the flag: in Rails console run Account.site_admin.enable_feature!(:custom_gradebook_statuses) or use the site-admin Feature Options UI","Confirm the flag on the correct environment (site admin account, not a sub-account)","Gate the client-side call behind the same flag check so the mutation is never invoked when disabled","Contact Canvas support/admin if the flag is unavailable on a hosted instance"],"exampleFix":"// before\nawait updateStandardGradeStatus({ name: \"mastery\", color: \"#00AA00\" })\n// after\nif (ENV.featureFlags.customGradebookStatuses) {\n  await updateStandardGradeStatus({ name: \"mastery\", color: \"#00AA00\" })\n}","handlingStrategy":"try-catch","validationCode":"if (!ENV.featureFlags?.customGradebookStatuses) {\n  throw new Error('mutation unavailable: custom_gradebook_statuses flag disabled')\n}","typeGuard":null,"tryCatchPattern":"try {\n  await client.mutate(UPSERT_STANDARD_GRADE_STATUS, vars)\n} catch (e) {\n  if (/feature flag is disabled/.test(e.message)) {\n    disableUiFeature()\n  } else throw e\n}","preventionTips":["Check the feature flag state via ENV/feature options before calling","Keep flag state consistent across environments you test on","Never ship UI invoking the mutation without flag gating"],"tags":["graphql","feature-flag","mutation"],"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"}