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

Error hiding assignment grades

Error message

Error hiding assignment grades

What it means

A terminal fallback: the mutation initiated the hide job but the resulting Progress object did not end up completed/queued as expected (the post/hide operation returned without success), so it raises a generic 'Error hiding assignment grades'. This indicates the internal post_grades/hide flow (Submission.count > 0 guard / PostAssignmentGrades job scheduling) failed rather than an input problem.

Solutions

  1. Check that the targeted submissions actually have posted grades: query submissions' posted_at/score for the assignment/students in scope.
  2. Inspect Rails/Delayed::Job logs and the Progresses table for the failed job; retry once job infrastructure is healthy.
  3. Verify there is at least one graded submission matching the student/section filters before calling; expand filters if empty.
  4. If reproducible, upgrade Canvas or check for known regressions in app/models/services/post_assignment_grades.rb flow.

Example fix

// before
await HideAssignmentGrades.mutate({ assignmentId, sectionIds });
// after
const subs = await api.get(`/courses/${cid}/assignments/${aid}/submissions`);
const posted = subs.filter(s => s.posted_at);
if (!posted.length) { console.warn('Nothing to hide: no posted submissions'); return; }
try { await HideAssignmentGrades.mutate({ assignmentId, sectionIds }); }
catch (e) { if (String(e).includes('Error hiding assignment grades')) await pollProgressAndRetry(); else throw e; }
Defensive patterns

Strategy: try-catch

Validate before calling

const posted = submissions.filter(s => s.posted_at);
if (!posted.length) { console.warn('No posted submissions to hide'); return; }

Type guard

const hasHideableWork = (submissions) => Array.isArray(submissions) && submissions.some(s => s.posted_at != null);

Try / catch

try {
  const res = await hideGrades({ assignmentId, sectionIds });
  const progress = res?.data?.hideAssignmentGrades?.progress;
  if (progress?.state === 'failed') throw new Error('Hide job failed: ' + progress.message);
} catch (e) {
  if (String(e).includes('Error hiding assignment grades')) {
    await checkJobInfrastructureAndLogs();
    await retryWithBackoff(() => hideGrades({ assignmentId, sectionIds }), 2);
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: There are zero submissions in scope for the hidden operation so the underlying posting service reports nothing was done; the asynchronous posting job fails to enqueue or the Progress never reaches a queued/completed state; an exception inside the posting service swallowed upstream results in a falsy progress.

Common situations: Hiding on an assignment where no grades were ever posted (no submissions with posted_at); gradebook plugins/late policies interfering; background job infrastructure (Delayed::Job/SQS) down; Canvas version changes to the posting workflow.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/hide_assignment_grades.rb:72

    visible_enrollments = visible_enrollments.where(user_id: input[:only_student_ids]) if input[:only_student_ids]
    visible_enrollments = visible_enrollments.where.not(user_id: input[:skip_student_ids]) if input[:skip_student_ids]

    submissions_scope = assignment.submissions.active.joins(user: :enrollments)
    submissions_scope = course.apply_enrollment_visibility(submissions_scope, current_user).merge(visible_enrollments)
    progress = course.progresses.new(tag: "hide_assignment_grades")

    if progress.save
      progress.process_job(
        assignment,
        :hide_submissions,
        { preserve_method_args: true, priority: Delayed::HIGH_PRIORITY },
        progress:,
        submission_ids: submissions_scope.pluck(:id),
        skip_content_participation_refresh: false
      )
      { assignment:, progress:, sections: }
    else
      raise GraphQL::ExecutionError, "Error hiding assignment grades"
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)