{"record":{"id":"5e54b70be48c2d05","repo":"instructure/canvas-lms","slug":"project-lhotse-is-not-enabled-for-this-course","errorCode":null,"errorMessage":"Project Lhotse is not enabled for this course.","messagePattern":"Project Lhotse is not enabled for this course\\.","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/auto_grade_submission.rb","lineNumber":43,"sourceCode":"  field :progress, Types::ProgressType, null: true\n\n  def resolve(input:)\n    submission_id = GraphQLHelpers.parse_relay_or_legacy_id(input[:submission_id], \"Submission\")\n    submission = Submission.find(submission_id)\n\n    errors = []\n    GraphQLHelpers::AutoGradeEligibilityHelper.validate_assignment(assignment: submission.assignment).each { |i| append_issue_message(errors, i) }\n    GraphQLHelpers::AutoGradeEligibilityHelper.validate_submission(submission:).each { |i| append_issue_message(errors, i) }\n\n    if errors.any?\n      raise GraphQL::ExecutionError, \"Auto-grading failed due to the following issue(s): #{errors.join(\", \")}\"\n    end\n\n    course = submission.assignment&.course\n    raise \"Course not found\" unless course\n\n    unless course.feature_enabled?(:project_lhotse)\n      raise GraphQL::ExecutionError, I18n.t(\"Project Lhotse is not enabled for this course.\")\n    end\n\n    verify_authorized_action!(course, :manage_grades)\n\n    service = AutoGradeOrchestrationService.new(course:, current_user:)\n    progress = service.auto_grade_in_background(submission:)\n\n    { progress: }\n  rescue GraphQL::ExecutionError => e\n    Rails.logger.error(\"[AutoGradeSubmission GraphQL ExecutionError] #{e.message}\")\n    raise e\n  rescue => e\n    Rails.logger.error(\"[AutoGradeSubmission ERROR] #{e.message}\")\n    raise GraphQL::ExecutionError, I18n.t(\"An unexpected error occurred while grading.\")\n  end\n\n  def append_issue_message(errors, issue)\n    errors << issue[:message] if issue && issue[:level] == \"error\"","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/auto_grade_submission.rb#L25-L61","documentation":"After eligibility checks, AutoGradeSubmission requires the course to have the `project_lhotse` feature flag enabled; otherwise it raises 'Project Lhotse is not enabled for this course.' via I18n. This is the Auto Grade feature gate on the course's root account/course.","triggerScenarios":"Calling autoGradeSubmission on a course where course.feature_enabled?(:project_lhotse) is false — flag not enabled, enabled only at site admin, or enabled on a different course/account.","commonSituations":"Testing Auto Grade in a sandbox where the flag was never enabled; flag rolled out per-account but mutation used on an unenrolled course account; after environment refresh wiped feature flag settings.","solutions":["Enable the project_lhotse feature flag on the course or its root account (Settings > Feature Options or `course.enable_feature!(:project_lhotse)`).","In specs, use `course.root_account.enable_feature!(:project_lhotse)` or stub feature_enabled?.","Confirm the course object resolved from the submission is the one you enabled the flag on.","Verify per-environment flag settings (prod vs test)."],"exampleFix":"// before\nmutation { autoGradeSubmission(...) } # flag off\n\n// after\nCourse.find(course_id).enable_feature!(:project_lhotse) # or root account level\n# then call mutation","handlingStrategy":"validation","validationCode":"if (!course.feature_enabled?(:project_lhotse))\n  raise 'enable project_lhotse before auto grading'\n","typeGuard":"def lhotse_enabled?(course)\n  course.respond_to?(:feature_enabled?) && course.feature_enabled?(:project_lhotse)\nend","tryCatchPattern":"begin\n  auto_grade_submission(submission)\nrescue GraphQL::ExecutionError => e\n  enable_flag_or_notify if e.message.include?('Project Lhotse is not enabled')\nend","preventionTips":["Enable project_lhotse in all environments using Auto Grade","Gate Auto Grade UI on the course flag","Verify flag on the exact course, not just site admin"],"tags":["graphql","feature-flag","auto-grading","canvas-lms"],"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"}