Scheduler settings cannot be migrated due to RequirementsException: No database connection available for source plugin variable

Created on 12 August 2025, 4 days ago

Problem/Motivation

When running drush cr on a site with Scheduler 2.2.1 on Drupal Core 10.5.1, the following warning appears in the logs:

The Scheduler configuration cannot be migrated due to RequirementsException: No database connection available for the source plugin variable, line 218 in /var/www/html/web/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php

The warning appears to be caused by the migration plugin attempting to access a database connection that is currently unavailable, which prevents configuration migration and generates noise in the logs.

Steps to reproduce

  • Have Scheduler 2.2 installed on Drupal 10.5.0.
  • Run drush cr.
  • Review the logs for the warning as mentioned above.
🐛 Bug report
Status

Active

Version

2.2

Component

Plugin

Created by

🇪🇸Spain antonio.nunez Spain

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @antonio.nunez
  • @antonio-nunez opened merge request.
  • 🇪🇸Spain antonio.nunez Spain

    When running migrations, the Scheduler module tries to use the 'variable' source plugin, which requires a legacy database connection.
    If this connection is not available, a RequirementsException is thrown, causing a notice during cache rebuild or other operations.

    This solution adds a minimal check for the legacy database connection before attempting to create the stub migration.
    If the connection is missing, the migration alteration early-exits gracefully, preventing the exception and related log notices.

    This avoids cluttering logs and errors in environments where the legacy database is not present or migrations are not needed,
    without changing the Scheduler migration functionality when the connection is available.

  • 🇬🇧United Kingdom jonathan1055

    Hi antonio nunez,
    Thanks for raising this, and for providing the MR. I have to admit that someone else wrote the Scheduler migration process, and so I do not have an in-depth knowledge of all the details, but if you have found the situation where there is no database connection then yes I agree that simple check and early exit is the correct thing to do. I have not been able to replicate this error. It is clearly not as simple as the two steps you list in the issue summary. How exactly did you get the scenario of not having the database connection?

Production build 0.71.5 2024