{"record":{"id":"10ebf4141e5875e9","repo":"instructure/canvas-lms","slug":"a-deleted-cross-listing-failed-e","errorCode":null,"errorMessage":"A deleted cross-listing failed: #{e}","messagePattern":"A deleted cross-listing failed: #(.+?)","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/xlist_importer.rb","lineNumber":117,"sourceCode":"\n            begin\n              @course_ids_to_update_associations.merge [@course.id, section.course_id, section.nonxlist_course_id].compact\n              section.crosslist_to_course(@course, run_jobs_immediately: true)\n            rescue => e\n              raise ImportError, \"An active cross-listing failed: #{e}\"\n            end\n\n          when /\\Adeleted\\z/i\n            if @course && section.course_id != @course.id\n              @success_count += 1\n              return\n            end\n\n            begin\n              @course_ids_to_update_associations.merge [section.course_id, section.nonxlist_course_id]\n              section.uncrosslist(run_jobs_immediately: true)\n            rescue => e\n              raise ImportError, \"A deleted cross-listing failed: #{e}\"\n            end\n\n          else\n            raise ImportError, \"Improper status #{status} for a cross-listing\"\n          end\n\n          @success_count += 1\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":99,"sourceCodeEnd":130,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/xlist_importer.rb#L99-L130","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"section = root_account.course_sections.find_by(sis_source_id: section_id)\nif section && section.nonxlist_course_id && !root_account.all_courses.exists?(section.nonxlist_course_id)\n  raise \"Original course #{section.nonxlist_course_id} missing; cannot uncrosslist\"\nend","typeGuard":null,"tryCatchPattern":"begin\n  xlist.add_crosslist(xlist_course_id, section_id, 'deleted')\nrescue SIS::ImportError => e\n  cause = e.message.sub(/\\AA deleted cross-listing failed: /, '')\n  Rails.logger.error(\"Uncrosslist failed: #{cause}\")\nend","preventionTips":["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"],"tags":["sis","import","cross-listing","wrapped-exception"],"backgroundTag":"api-error-response","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}