Drupal8 FieldException: Attempt to create a field storage without a field name

After a drush upgrade from 8.4.2 to 8.4.4, my site went down with "The website encountered an unexpected error. Please try again later." error, and the error log is filling up with this message:

Uncaught PHP Exception Drupal\Core\Field\FieldException: "Attempt to create a field storage without a field name." at /var/www/mysite.com/htdocs/core/modules/field/src/Entity/FieldStorageConfig.php line 246

Drush couldn't clear caches (the above error popped up). I tried everything I could think of, including:

  • truncated all the cache* tables in the database. 
  • replaced the installation's codebase with 8.4.2, 8.4.3, and clean/new 8.4.4 versions of Drupal.

I modified line 246 in FieldStorageConfig.php to dump the variable when an exception occurs, hoping to get more details: 

throw new FieldException('There\'s a problem with the name: ' . var_dump($values) );
//throw new FieldException('Attempt to create a field storage without a field name.');

That yielded some more details:

array(3) {
  string(23) "library_item_field_type"
  array(1) {
    string(12) "library_item"
  string(7) "library"
The website encountered an unexpected error. Please try again later.

I found the library module, but couldn't uninstall it with drush. Moved the ./modules/library folder out of the drupal installation. That brought about a new error:

RuntimeException: Unable to determine class for field type 'library_item_field_type' found in the 'field.storage.' configuration in /var/www/mysite.com/htdocs/core/modules/field/src/FieldStorageConfigStorage.php:157

In the database, I looked for all the field.storage entries in the config table:

select * from config where name like '%field.storage.node%'

Of all the listings, it was obvious that the field.storage.node.library_item's YAML was the most pathetic...it was less than half the length of any of the others and not structured the same way. Also, there was no 'name' or 'field_name' in it. The Library module's drupal module page appeared to have not been updated in more than two months, and warned that it's not covered by Drupal's security advisory policy. It's apparently outdated.


I executed this on the database:

delete from config where name like '%field.storage.node.library_item%'

...and the site popped back to life. Just like that. I don't even remember why the Library module was installed in the first place, so that's all good.

Cross-posted on Drupal's support site, though I ended up finding my own solution.

Add new comment

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.