instructure/canvas-lms · error
This assignment can't be duplicated
Error message
This assignment can't be duplicated
What it means
AbstractAssignment#duplicate refuses to duplicate assignments whose can_duplicate? is false — assignments carrying non-cloneable associations (external tool/LTI submissions, quizzes with certain settings, discussions, etc.) raise this error up front.
Solutions
- Check assignment.can_duplicate? before calling duplicate and hide/disable the Duplicate affordance otherwise
- Use the supported duplicate path for quizzes/LTI tools (e.g. tool-provided duplicate handling)
- If a new assignment type should be duplicable, update can_duplicate? and the duplication logic in abstract_assignment.rb
Example fix
// before const canDuplicate = true; // assumed // after const canDuplicate = assignment.canDuplicate && !(assignment.externalToolTagId); if (canDuplicate) duplicateAssignment(assignment); else showDuplicateDisabledTooltip();
Defensive patterns
Strategy: validation
Validate before calling
const canDuplicate = assignment.canDuplicate !== false &&
!assignment.externalToolTagId &&
!['quiz','discussion_topic'].includes(assignment.submissionTypes?.[0]);
if (!canDuplicate) throw new SkipError('Assignment cannot be duplicated'); Type guard
function isDuplicable(a) {
return a != null && typeof a.id === 'number' && a.canDuplicate === true;
} Try / catch
try {
await duplicateAssignment(assignmentId);
} catch (e) {
if (e.message.includes("can't be duplicated")) {
showError('This assignment type cannot be duplicated.');
}
} Prevention
- Check can_duplicate? before offering the Duplicate action
- Exclude external-tool and submission-bearing assignments from bulk duplication scripts
- Keep can_duplicate? updated when adding new submission types
- Surface the duplicate capability flag in the API response the UI consumes
When it happens
Trigger: Calling assignment.duplicate (or the duplicate assignment UI/API action) on an assignment where can_duplicate? returns false: LTI/external-tool assignments, assignments with submissions or provisional grades, unsupported discussion topics.
Common situations: Users clicking Duplicate on an external tool assignment; scripts bulk-duplicating mixed assignment sets; new submission types added without updating can_duplicate?.
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
- Must be a group assignment to create group overrides
- Peer review sub assignment exists
- A course did not pass validation
- A # user did not pass validation (user: # , # : # , error…
- A maximum of 50 assessees can be provided at once
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/998bfbdf613280d0.
Report an issue: GitHub.
Appendix: source
Thrown at app/models/abstract_assignment.rb:385
end
# The relevant associations that are copied are:
#
# learning_outcome_alignments, rubric_association, wiki_page,
# assignment_configuration_tool_lookups
#
# In the case of wiki_page, a new wiki_page will be created. The underlying
# rubric association, however, will simply point to the original rubric
# rather than copying the rubric.
#
# Other has_ relations are not duplicated for various reasons.
# These are:
#
# attachments, submissions, provisional_grades, lti stuff, discussion_topic
# ignores, moderated_grading_selections, teacher_enrollment
# TODO: Try to get more of that stuff duplicated
def duplicate(opts = {})
raise "This assignment can't be duplicated" unless can_duplicate?
# Don't clone a new record
return self if new_record?
default_opts = {
discussion_topic_for_checkpoints: nil,
duplicate_wiki_page: true,
duplicate_discussion_topic: true,
duplicate_plagiarism_tool_association: true,
duplicate_asset_processors: true,
copy_title: nil,
user: nil
}
opts_with_default = default_opts.merge(opts)
result = clone
result.saving_user = opts[:user]
result.all_submissions.clearView on GitHub (pinned to 1c9f0bb801)