I'm getting this error. The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection

I'm using Lightning 2.1.6. I set up a media upload field on my page content type using reference to content/ reference media. It also uses the media browser to upload images. This field allows a single image upload. I get the error when you try to upload an image. And the image doesn't get added. If i allow multiple upload instead of single the error goes away. Also If I disable the "Interface Translation" module the error goes away and the images can be uploaded.

  • What is the question? : D This sounds more like a contrib module bug. Post it on Lightning distribution issue page.
    – ssibal
    Commented Aug 29, 2017 at 12:45
  • I found that if i uninstall the Interface Translation module the error goes away. Commented Aug 30, 2017 at 5:15
  • Okey, go and post it here: drupal.org/project/issues/lightning?categories=1
    – ssibal
    Commented Aug 30, 2017 at 5:31
  • Thank you! I posted under normal Drupal issues. Because the translation modules are part of Drupal core not Lightning. drupal.org/node/2905618 Commented Aug 30, 2017 at 12:22
  • 1
    Sounds like you ran into the core bug "StringTranslationTrait consumers cannot be reliably serialized without DependencySerializationTrait". Try using the patch from comment #21 here: drupal.org/node/2893029 Commented Sep 1, 2017 at 14:48

1 Answer 1


I experienced this issue after manually deleting some translated configuration files. From then on I was not able to successfully config import anymore without being interrupted with the fatal error from your question.

I then tried to run config import after uninstalling locale, which worked but have also deleted lots of translation from the database. Bad.

I could restore the configs in question and then remove them from the UI before exporting them again. Boring.

So I deleted the original configuration objects from an update function (and thereby also deleted the translations), and afterwards run configuration import again, where the original configs then got restored automatically (as their files still existed) WITHOUT translation.

 * Remove unwanted translations.
function MYMODULE_update_8005(&$sandbox) {

  $configs = [

  foreach ($configs as $config) {

EDIT: Only shortly after I had the same problem again. Again it was a missing config (I deleted manually, don't do that) and took me hours to find out which one exactly. This time it was menu_item_extras which required menu_item_extras.utility.yml. Actually I uninstalled menu_item_extras but maybe menu_item_extras can't be uninstalled that simply. But that's a different issue.

What's left to conclude now is: Did you manually delete some config files prior to getting this error?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.