instructure/canvas-lms · error · ImportError
A deleted cross-listing failed: #
Error message
A deleted cross-listing failed: #{e} What it means
When applying a 'deleted' cross-listing (uncross-listing), section.uncrosslist is wrapped in a rescue that re-raises ImportError with "A deleted cross-listing failed: #{e}". Any failure moving the section back to its original (nonxlist) course is converted into this ImportError with the underlying message appended.
Solutions
- Inspect the wrapped message after 'A deleted cross-listing failed:' for the root cause
- Verify the section's nonxlist_course_id / original course still exists and is not deleted
- Re-run the SIS import after repairing course/section data
- Check inline job logs (run_jobs_immediately: true) for the failing step
Defensive patterns
Strategy: try-catch
Validate before calling
section = root_account.course_sections.find_by(sis_source_id: section_id)
if section && section.nonxlist_course_id && !root_account.all_courses.exists?(section.nonxlist_course_id)
raise "Original course #{section.nonxlist_course_id} missing; cannot uncrosslist"
end Try / catch
begin
xlist.add_crosslist(xlist_course_id, section_id, 'deleted')
rescue SIS::ImportError => e
cause = e.message.sub(/\AA deleted cross-listing failed: /, '')
Rails.logger.error("Uncrosslist failed: #{cause}")
end Prevention
- Verify nonxlist_course_id points to an existing course before uncrosslisting
- Restore soft-deleted original courses before processing deletes
- Avoid concurrent mutation of sections during import
- Watch inline job logs when run_jobs_immediately: true
When it happens
Trigger: add_crosslist with status 'deleted' where the section currently sits in the xlist course (section.course_id == @course.id or @course is nil) and uncrosslist raises — DB errors, invalid original course state, or callback/job failures with run_jobs_immediately: true.
Common situations: The section's nonxlist_course_id points at a deleted or missing course; concurrent edits to the section during SIS import; inline job failures while restoring enrollments during uncrosslist.
Related errors
- An active cross-listing failed: #
- A cross-listing referenced a non-existent section #
- Improper status "# " for a cross-listing
- No section_id given for a cross-listing
- A new_id, '# ', referenced an existing # and the # with #…
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/10ebf4141e5875e9.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/xlist_importer.rb:117
begin
@course_ids_to_update_associations.merge [@course.id, section.course_id, section.nonxlist_course_id].compact
section.crosslist_to_course(@course, run_jobs_immediately: true)
rescue => e
raise ImportError, "An active cross-listing failed: #{e}"
end
when /\Adeleted\z/i
if @course && section.course_id != @course.id
@success_count += 1
return
end
begin
@course_ids_to_update_associations.merge [section.course_id, section.nonxlist_course_id]
section.uncrosslist(run_jobs_immediately: true)
rescue => e
raise ImportError, "A deleted cross-listing failed: #{e}"
end
else
raise ImportError, "Improper status #{status} for a cross-listing"
end
@success_count += 1
end
end
end
end
end
View on GitHub (pinned to 1c9f0bb801)