instructure/canvas-lms · error · ImportError

An active cross-listing failed: #

Error message

An active cross-listing failed: #{e}

What it means

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.

Solutions

  1. Read the wrapped inner message after 'An active cross-listing failed:' to find the root cause
  2. Verify both the section and target course are in valid, non-deleted states before importing
  3. Re-run the SIS import after fixing the underlying data — crosslist operations are idempotent (already-matched sections short-circuit)
  4. Check job logs for inline job failures triggered by run_jobs_immediately: true
Defensive patterns

Strategy: try-catch

Try / catch

begin
  xlist.add_crosslist(xlist_course_id, section_id, 'active')
rescue SIS::ImportError => e
  cause = e.message.sub(/\AAn active cross-listing failed: /, '')
  Rails.logger.error("Crosslist failed: #{cause}")
end

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/5f5f2f152145e978. Report an issue: GitHub.

Appendix: source

Thrown at lib/sis/xlist_importer.rb:104

          when /\Aactive\z/i

            if @course.deleted?
              @course.workflow_state = "claimed"
              @course.save_without_broadcasting!
              @course.update_enrolled_users
              @course_ids_to_update_associations.add @course.id
            end

            if section.course_id == @course.id
              @success_count += 1
              return
            end

            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

View on GitHub (pinned to 1c9f0bb801)