Skip to main content


Adding a new service to a custom module and the following error greeted me:

The website encountered an unexpected error. Try again later.

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "summaries.reference_node". in Drupal\Component\DependencyInjection\Container->get() (line 157 of core/lib/Drupal/Component/DependencyInjection/Container.php).


How to log mail sent from the site for debugging when the body of the message is encrypted

To view the email before it's sent from Drupal, especially when using Drupal 10 and dealing with encrypted emails or a specific module like Mailhandler, you can take a few steps to intercept or debug the email before it's actually dispatched. The process involves either configuring your configuration for debugging emails or using a development tool/module that captures outgoing emails.


Using Drush to run SQL commands

To run a SQL command using Drush, use the following sql-query command

drush sql-query "COMMAND"

As an example, in the following I will remove all of the records in the Watchdog.


Delete from watchdog

To empty (clear) the watchdog table, which contains Drupal's log messages, using the above noted command. The command to delete all entries from the watchdog table is as follows:

Drupal logger and serialising objects such as MessageInterface

In Drupal, the logging system is based on the PSR-3 logging standard, which Drupal integrates through the \Psr\Log\LoggerInterface. When you want to log messages, you typically use placeholders in your message string, which are replaced with context array values.

Notice: Only variables should be passed by reference in load_view_block_content()

Working through the following error

Notice: Only variables should be passed by reference in load_view_block_content() (line 391 of /var/www/vhosts/{domain}/httpdocs/themes/custom/{theme}/{theme}.theme.theme)

If you want to read the full error, scroll to the bottom in Appendix.  The related function to this error is

Could not apply patch! Skipping

Attempting to apply a patch in Drupal 10.2.4 that had been working until this version.  Now I'm seeing the following error

Could not apply patch! Skipping. The error was: The process "patch '-p1' --no-backup-if-mismatch -d '/Users/andrewfletcher/Sites/codebales/modules/contrib/facets' < '/Users/andrewfletcher/Sites/codebales/patches/3336646-function-is-deprecated.patch'" exceeded the timeout of 300 seconds.


How to check or compare files recorded in the files tables against actual file in the directory

Have you had the situation where you needed to compare the files recorded in the database (e.g., file_managed table) against the actual files in the file system directory (sites/default/files/...). This is useful for scenarios where you want to ensure that the database records and the physical files are in sync.  To do this perform the following steps:

Subscribe to 10.x