We have the following set up for Drupal 8.6.3 - IIS Server, MSSQL Server, sqlsrv drivers. However, every few hours, Drupal throws PHP errors(all of them belonging to the same kind) and most pages from the application become inaccessible. The error message is very long so I pasted the first 7 lines below. It doesn't depend on what plugin is being requested. The error is always raised at Drupal\Core\Plugin\DefaultPluginManager::doGetDefinition(). Once we clear caches using drush cr the page becomes accessible again.

TypeError: Argument 1 passed to Drupal\Core\Plugin\DefaultPluginManager::doGetDefinition() must be of the type array, boolean given, called in 
E:\IISRoot\drupal-app\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait.php on line 25 in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 43 of E:\IISRoot\drupal-app\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php) 

#0 E:\IISRoot\drupal-app\core\lib\Drupal\Component\Plugin\Discovery\DiscoveryCachedTrait.php(25): Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition(false, 'views_query', true) 
#1 E:\IISRoot\drupal-app\core\lib\Drupal\Core\Plugin\Factory\ContainerFactory.php(16): Drupal\Core\Plugin\DefaultPluginManager->getDefinition('views_query') 
#2 E:\IISRoot\drupal-app\core\lib\Drupal\Component\Plugin\PluginManagerBase.php(83): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('views_query', Array) 
#3 E:\IISRoot\drupal-app\core\modules\views\src\Plugin\views\display\DisplayPluginBase.php(817): Drupal\Component\Plugin\PluginManagerBase->createInstance('views_query') 
#4 E:\IISRoot\drupal-app\core\modules\views\src\ViewExecutable.php(1182): Drupal\views\Plugin\views\display\DisplayPluginBase->getPlugin('query') 
#5 E:\IISRoot\drupal-app\core\modules\views\src\ViewExecutable.php(1222): Drupal\views\ViewExecutable->initQuery() 
#6 E:\IISRoot\drupal-app\core\modules\views\src\Plugin\views\display\PathPluginBase.php(390): Drupal\views\ViewExecutable->build() 
#7 E:\IISRoot\drupal-app\core\modules\views\src\Plugin\views\display\Page.php(180): Drupal\views\Plugin\views\display\PathPluginBase->execute() 

I went through the DiscoveryCachedTrait.php file where the error is being raised. It has the $definitions variable which has the cached definitions. If this variable is not set, the method getDefinitions() is being called. Ultimately, $definitions is being passed to the method doGetDefinition(). This method expects $definitions to be an array, but a boolean is being passed instead.


namespace Drupal\Component\Plugin\Discovery;

trait DiscoveryCachedTrait {

  use DiscoveryTrait;

   * Cached definitions array.
   * @var array
  protected $definitions;

   * {@inheritdoc}
  public function getDefinition($plugin_id, $exception_on_invalid = TRUE) {
    // Fetch definitions if they're not loaded yet.
    if (!isset($this->definitions)) {

    return $this->doGetDefinition($this->definitions, $plugin_id, $exception_on_invalid);


The signature for the method doGetDefinition() from DiscoveryTrait.php file is as following. As mentioned in the comments doc block, it expects $definitions to be an array containing the available plugin definitions.

* Gets a specific plugin definition.
* @param array $definitions
*   An array of the available plugin definitions.
* @param string $plugin_id
*   A plugin id.
* @param bool $exception_on_invalid
*   If TRUE, an invalid plugin ID will cause an exception to be thrown; if
*   FALSE, NULL will be returned.
* @return array|null
*   A plugin definition, or NULL if the plugin ID is invalid and
*   $exception_on_invalid is TRUE.
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*   Thrown if $plugin_id is invalid and $exception_on_invalid is TRUE.
protected function doGetDefinition(array $definitions, $plugin_id, $exception_on_invalid) {
    // Avoid using a ternary that would create a copy of the array.
    if (isset($definitions[$plugin_id])) {
    return $definitions[$plugin_id];
    elseif (!$exception_on_invalid) {
    return NULL;

    throw new PluginNotFoundException($plugin_id, sprintf('The "%s" plugin does not exist.', $plugin_id));

My guess is that the $definitions array in DiscoveryCachedTrat.php is being fetched from cache, and for some reason, its sometimes loading a boolean value instead of an array. We have the issue in two Drupal applications running with same setup. We didn't see this issue on the Drupal application earlier, when it was running in Apache Web Server and using MySQL server for the database.

Has anyone seen this kind of error in their Drupal applications? I did a lot of troubleshooting but couldn't resolve this error. I am ready to provide any more information if needed.

  • "The error message is very long so I pasted the first 7 lines" - You can tell so far it is a View which is broken, for example a handler plugin configured does not exist. Most times you find the View name in the stack trace in a line further down.
    – 4uk4
    Jan 24, 2019 at 7:51
  • The issue appears with different plugins, not just one. So, I think it has something to do with cache. In the example I provided above, it occurs with the plugin 'query' as mentioned in line #4 Jan 24, 2019 at 15:08
  • The cache_discovery table has information about plugin definitions. This may or may not be cleared for a specific plugin manager. Truncating the table should be safe, but you probably want to take a back up. The only times I've needed to do this is during development when I really mess up my annotations and I don't feel like uninstalling and re-installing my module.
    – mradcliffe
    Jan 24, 2019 at 22:26
  • Manually clearing all the cache tables didn't help. The issue keeps recurring. I'm thinking more in the way that caches on the MS SQL Server database are getting corrupted time to time. Are there any particular settings that Drupal requires for the cache being stored on the Database? Jul 8, 2019 at 21:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.