instructure/canvas-lms · error · GraphQL::ExecutionError
Anonymous assignments cannot be hidden by section
Error message
Anonymous assignments cannot be hidden by section
What it means
Anonymous-student assignments (assignment.anonymize_students?) cannot have grades hidden or posted per-section, since filtering by section would link posted/hidden grade visibility to identifiable section membership. The mutation refuses the request up front.
Solutions
- Call the whole-assignment hide (hideAssignmentGrades without section_ids) instead, if allowed — note anonymized assignments restrict posting entirely; check policy.
- Disable 'Grade Anonymously' on the assignment (if no submissions/grades yet) when section-level grade management is required.
- In UI, hide/disable the section picker whenever assignment.anonymizeStudents is true.
- Distinguish the flags in client logic: anonymizeStudents vs anonymousGrading trigger different restrictions.
Example fix
// before
await HideBySection.mutate({ assignmentId, sectionIds });
// after
if (assignment.anonymizeStudents) {
showError('Anonymous assignments cannot be managed by section');
} else {
await HideBySection.mutate({ assignmentId, sectionIds });
} Defensive patterns
Strategy: validation
Validate before calling
if (assignment.anonymizeStudents && sectionIds?.length) {
throw new ValidationError('Section-scoped hide is unavailable for anonymized assignments');
} Type guard
const allowsSectionScoping = (a) => Boolean(a && !a.anonymizeStudents && !a.anonymousGrading);
Try / catch
try { await hideBySection({ assignmentId, sectionIds }); }
catch (e) {
if (String(e).includes('Anonymous assignments')) { showError('Use whole-assignment grade management for anonymized assignments'); return; }
throw e;
} Prevention
- Disable section pickers when assignment.anonymizeStudents is true
- Distinguish anonymizeStudents vs anonymousGrading flags in client models
- Review grade-tooling defaults that always pass section_ids
- Test workflows against anonymized assignment fixtures
When it happens
Trigger: Calling hideAssignmentGradesForSections on an assignment where 'Grade Anonymously' (anonymize_students) is on, with any section_ids.
Common situations: TA workflows in anonymous-grading assignments where per-section scoping is habitual; tooling that generically applies section filters to all assignments; confusion between anonymous_grading (provisional/moderated anonymity) and anonymize_students (grader anonymity) flags.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Anonymous assignments cannot be posted by section
- and cannot be used together
- A course with that id does not exist
- Anonymous assignments cannot be posted by graded only
- Anonymous assignments cannot be posted by section
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/2602086bb5795285.
Report an issue: GitHub.
Appendix: source
Thrown at app/graphql/mutations/hide_assignment_grades_for_sections.rb:45
field :assignment, Types::AssignmentType, null: true
field :progress, Types::ProgressType, null: true
field :sections, [Types::SectionType], null: true
def resolve(input:)
begin
assignment = AbstractAssignment.find_assignment_or_peer_review(input[:assignment_id])
course = assignment.context
sections = course.course_sections.where(id: input[:section_ids])
rescue ActiveRecord::RecordNotFound
raise GraphQL::ExecutionError, "not found"
end
verify_authorized_action!(assignment, :grade)
unless assignment.grades_published?
raise GraphQL::ExecutionError, "Assignments under moderation cannot be hidden by section before grades are published"
end
raise GraphQL::ExecutionError, "Anonymous assignments cannot be hidden by section" if assignment.anonymize_students?
if sections.empty? || sections.count != input[:section_ids].size
raise GraphQL::ExecutionError, "Invalid section ids"
end
visible_enrollments = course.apply_enrollment_visibility(course.student_enrollments, current_user, sections)
submissions_scope = input[:graded_only] ? assignment.submissions.graded : assignment.submissions
submissions_scope = submissions_scope.joins(user: :enrollments).merge(visible_enrollments)
progress = course.progresses.new(tag: "hide_assignment_grades_for_sections")
if progress.save
progress.process_job(
assignment,
:hide_submissions,
{ preserve_method_args: true, priority: Delayed::HIGH_PRIORITY },
progress:,View on GitHub (pinned to 1c9f0bb801)