instructure/canvas-lms · error · GraphQL::ExecutionError
Auto-grading failed due to the following issue(s): #
Error message
Auto-grading failed due to the following issue(s): #{errors.join(", ")} What it means
AutoGradeSubmission.resolve validates the assignment and submission via AutoGradeEligibilityHelper first; any eligibility issue is collected and raised together as a single GraphQL::ExecutionError listing all issues, aborting auto-grading before orchestration starts.
Solutions
- Read the joined issue messages in the error — they enumerate each failed validation from validate_assignment/validate_submission.
- Fix each listed condition (publish the assignment, correct submission state, use an eligible assignment type).
- Pre-check eligibility client-side by replicating/invoking the same validation before mutating.
- Ensure the assignment and submission are in a state Auto Grade supports (e.g., student-submitted, gradable type).
Example fix
// before
mutation { autoGradeSubmission(input: { submissionId }) } # ineligible submission
// after: pre-validate
issues = [...AutoGradeEligibilityHelper.validate_assignment(assignment:),
...AutoGradeEligibilityHelper.validate_submission(submission:)]
if issues.empty? then # run mutation end Defensive patterns
Strategy: validation
Validate before calling
const issues = [
...AutoGradeEligibilityHelper.validate_assignment({ assignment }),
...AutoGradeEligibilityHelper.validate_submission({ submission })
]
if (issues.length) throw new Error(issues.join(', '))
Try / catch
try {
await autoGradeSubmission({ submissionId })
} catch (e) {
if (e.message.startsWith('Auto-grading failed')) displayIssues(parseIssues(e.message))
} Prevention
- Pre-check eligibility before offering Auto Grade UI
- Surface per-issue messages to users
- Keep assignment/submission states compatible with auto grading
When it happens
Trigger: Calling the autoGradeSubmission mutation when the assignment/submission fail eligibility checks — e.g., assignment not an eligible type, submission in wrong state, no student submission content, assignment not published, etc., as determined by the helper.
Common situations: Auto-grading an unsubmitted or graded submission; assignment type not supported by Auto Grade; feature prerequisites (assignment settings) unmet; running on submissions of quizzes or non-essay types the helper rejects.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- cannot import a root group
- Invalid context type
- Invalid section ids
- Outcome is not available in context #
- Outcome is not available in context #
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/e29264dc91c13b83.
Report an issue: GitHub.
Appendix: source
Thrown at app/graphql/mutations/auto_grade_submission.rb:36
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
class Mutations::AutoGradeSubmission < Mutations::BaseMutation
argument :submission_id, ID, required: true
field :error, String, null: true
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 eView on GitHub (pinned to 1c9f0bb801)