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

Project Lhotse is not enabled for this course.

Error message

Project Lhotse is not enabled for this course.

What it means

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.

Solutions

  1. Enable the project_lhotse feature flag on the course or its root account (Settings > Feature Options or `course.enable_feature!(:project_lhotse)`).
  2. In specs, use `course.root_account.enable_feature!(:project_lhotse)` or stub feature_enabled?.
  3. Confirm the course object resolved from the submission is the one you enabled the flag on.
  4. Verify per-environment flag settings (prod vs test).

Example fix

// before
mutation { autoGradeSubmission(...) } # flag off

// after
Course.find(course_id).enable_feature!(:project_lhotse) # or root account level
# then call mutation
Defensive patterns

Strategy: validation

Validate before calling

if (!course.feature_enabled?(:project_lhotse))
  raise 'enable project_lhotse before auto grading'

Type guard

def lhotse_enabled?(course)
  course.respond_to?(:feature_enabled?) && course.feature_enabled?(:project_lhotse)
end

Try / catch

begin
  auto_grade_submission(submission)
rescue GraphQL::ExecutionError => e
  enable_flag_or_notify if e.message.include?('Project Lhotse is not enabled')
end

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/auto_grade_submission.rb:43

  field :progress, Types::ProgressType, null: true

  def resolve(input:)
    submission_id = GraphQLHelpers.parse_relay_or_legacy_id(input[:submission_id], "Submission")
    submission = Submission.find(submission_id)

    errors = []
    GraphQLHelpers::AutoGradeEligibilityHelper.validate_assignment(assignment: submission.assignment).each { |i| append_issue_message(errors, i) }
    GraphQLHelpers::AutoGradeEligibilityHelper.validate_submission(submission:).each { |i| append_issue_message(errors, i) }

    if errors.any?
      raise GraphQL::ExecutionError, "Auto-grading failed due to the following issue(s): #{errors.join(", ")}"
    end

    course = submission.assignment&.course
    raise "Course not found" unless course

    unless course.feature_enabled?(:project_lhotse)
      raise GraphQL::ExecutionError, I18n.t("Project Lhotse is not enabled for this course.")
    end

    verify_authorized_action!(course, :manage_grades)

    service = AutoGradeOrchestrationService.new(course:, current_user:)
    progress = service.auto_grade_in_background(submission:)

    { progress: }
  rescue GraphQL::ExecutionError => e
    Rails.logger.error("[AutoGradeSubmission GraphQL ExecutionError] #{e.message}")
    raise e
  rescue => e
    Rails.logger.error("[AutoGradeSubmission ERROR] #{e.message}")
    raise GraphQL::ExecutionError, I18n.t("An unexpected error occurred while grading.")
  end

  def append_issue_message(errors, issue)
    errors << issue[:message] if issue && issue[:level] == "error"

View on GitHub (pinned to 1c9f0bb801)