Hi,

I think i have an aftermath issue which possibly started after repeatedly installing, testing, uninstalling and deleting my words and chars counter custom module, possibly corroding something in the process, but i'm not sure. The errors are talking about a missing embedded_video field that i had in a content type Video. 

Aside of having had a similar issue recently with 2 missing Profile test fields, which i fixed by adding empty tables to the database, just to get rid of base table not found errors, i was truncating many cache tables in the db containing embedded_video, but there's nothing that changes. The field in question, embedded_video, always reappears in the MYSQL search results as soon as i touch any link on my website. 

The reason why confused now is because the front-end error popped up after opening a node's missing image placeholder in a new tab: 

Private file system (seen from anon)

SQLSTATE[42S02]: Base table or view not found: 1146 Table '[myDB].field_data_field_embedded_video' doesn't exist: SELECT field_data_field_embedded_video0.`entity_type` AS `entity_type`, field_data_field_embedded_video0.`entity_id` AS `entity_id`, field_data_field_embedded_video0.`revision_id` AS `revision_id`, field_data_field_embedded_video0.`bundle` AS `bundle` FROM {field_data_field_embedded_video} field_data_field_embedded_video0 WHERE (`field_data_field_embedded_video0`.`field_embedded_video_fid` = :db_condition_placeholder_0) AND (`field_data_field_embedded_video0`.`deleted` = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => 171 [:db_condition_placeholder_1] => 0 ).

Note: This is an image field, completely unrelated to video. 
Can be seen only by logged-in users .

This completely unrelated error talks about an embedded video, revision_id, 'deleted', and db_condition_placeholder: 4 completely unexplained things. 

So, here's the log's moment where the first error occured:

That was at 4 in the morning, then i was working on removing everything from the custom module to restore clarity. And just a while ago  i opened that image in a new tab to find the above error.

The Log Error, contrary to the frontend, says this:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table '[myDB].field_data_field_embedded_video' doesn't exist: SELECT field_data_field_embedded_video0.`entity_type` AS `entity_type`, field_data_field_embedded_video0.`entity_id` AS `entity_id`, field_data_field_embedded_video0.`revision_id` AS `revision_id`, field_data_field_embedded_video0.`bundle` AS `bundle` FROM {field_data_field_embedded_video} field_data_field_embedded_video0 WHERE (`field_data_field_embedded_video0`.`field_embedded_video_fid` = :db_condition_placeholder_0) AND (`field_data_field_embedded_video0`.`deleted` = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => 171 [:db_condition_placeholder_1] => 0 ) in field_sql_storage_field_storage_query() (line 590 of /home/.sites/367/site8005016/web/5SD
/core/modules/field/modules/field_sql_storage/field_sql_storage.module).

And here's a long image of the log, filtered by errors since 4 in the morning. 

Lastly, i re-added the Video content type again with the same embedded_video field, and at this point i'm getting "machine-readable name is already in use".  

------

What i want to know:

  • How can i understand the nature of this error in general, even when i deleted all traces of embedded_video from all cache tables, even revisions? What is actually pulling this up?
  • Why do these deleted field names even reappear in cache_ tables after truncating everything? 
    (Is anything referring to field_embedded_video coming from server files somewhere?)
  • How do we deal with removed fields leaving leftovers? 
  • And most of all, is there a solution to this?

Accepted answer

I read this quickly, so I'm sure I'm missing something. Check your active config folder. Fields have two components:

  • Database tables
  • Field info and field instance info as json files

Very often the problem occurs when you delete the database tables and don't delete the configs, or vice versa.

To compound things, there is a core bug that prevents the deletion of some field information/tables when uninstalling a module that creates custom entities like Profile.

Comments

I read this quickly, so I'm sure I'm missing something. Check your active config folder. Fields have two components:

  • Database tables
  • Field info and field instance info as json files

Very often the problem occurs when you delete the database tables and don't delete the configs, or vice versa.

To compound things, there is a core bug that prevents the deletion of some field information/tables when uninstalling a module that creates custom entities like Profile.

There was indeed a field.field.field_embedded_video.js in it. 

Deleted it and the bug is gone. 

Last thing i was thinking about was doing a server search...

Epic answer! Thanks so much!!