{"record":{"id":"5f5f2f152145e978","repo":"instructure/canvas-lms","slug":"an-active-cross-listing-failed-e","errorCode":null,"errorMessage":"An active cross-listing failed: #{e}","messagePattern":"An active cross-listing failed: #(.+?)","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/xlist_importer.rb","lineNumber":104,"sourceCode":"          when /\\Aactive\\z/i\n\n            if @course.deleted?\n              @course.workflow_state = \"claimed\"\n              @course.save_without_broadcasting!\n              @course.update_enrolled_users\n              @course_ids_to_update_associations.add @course.id\n            end\n\n            if section.course_id == @course.id\n              @success_count += 1\n              return\n            end\n\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","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/xlist_importer.rb#L86-L122","documentation":"When applying an 'active' cross-listing, section.crosslist_to_course is wrapped in a rescue that re-raises ImportError with \"An active cross-listing failed: #{e}\". Any exception raised while moving the section into the target course (validation failures, DB errors, callback errors) is converted into this ImportError carrying the original message.","triggerScenarios":"add_crosslist with status 'active' where crosslist_to_course raises — e.g. the target course save fails, enrollment/association jobs blow up, or the section is in an inconsistent state (nil nonxlist_course_id handling aside, any StandardError in the move).","commonSituations":"Target course in a conflicting workflow state; concurrent SIS imports mutating the same section; data integrity issues (orphaned enrollments) surfacing during the move; job-runner errors when run_jobs_immediately: true executes inline.","solutions":["Read the wrapped inner message after 'An active cross-listing failed:' to find the root cause","Verify both the section and target course are in valid, non-deleted states before importing","Re-run the SIS import after fixing the underlying data — crosslist operations are idempotent (already-matched sections short-circuit)","Check job logs for inline job failures triggered by run_jobs_immediately: true"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  xlist.add_crosslist(xlist_course_id, section_id, 'active')\nrescue SIS::ImportError => e\n  cause = e.message.sub(/\\AAn active cross-listing failed: /, '')\n  Rails.logger.error(\"Crosslist failed: #{cause}\")\nend","preventionTips":["Keep course and section states valid before running SIS imports","Avoid concurrent imports touching the same sections","Monitor inline job failures (run_jobs_immediately: true)","Re-run imports after fixing data; operations are idempotent"],"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"}