EntityFieldQueryException: Unknown field: field_employee_additional in EntityFieldQuery->addFieldCondition() (line 767 of C:\xampp\htdocs\hris\includes\entity.inc).

I get this error whenever I delete fields in every content type. The "field_employee_additional" is a field collection I deleted lately but still appears in this error which means the deleted field is still in the database. I already re-installed the field collection and entity modules and nothing happened different. Anyone who also having this problem in field collection?

Comments

Jaypan’s picture

Try going to Reports -> field list, and see if you can delete the field there.

andsfestin’s picture

Hi Jay, thanks for the reply but the field is not there. It must be somewhere. It is being passed to the entity.inc together with the fields executed for deletion. Also checked the database with the field_ prefix, and saw nothing.

WorldFallz’s picture

First, since this isn't a coding question, I moved it to the appropriate place.

As for your question it looks like you might have deleted the field collection without removing the fields first (or maybe there's a bug in the field collection module). Maybe try dumping the db and grepping the .sql file for 'field_employee_additional' to see where it might be referenced. It has to be in there somewhere or the error message couldn't refer to it.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

andsfestin’s picture

Sorry but the data is still in the database indeed. When a field is being deleted, it will be stored in the database in these tables where entity.inc fetch those values:

field_config
field_config_instance

The data is stored in these tables where it is marked as deleted(1). The error disappeared after deleting those instances from the tables above. Thanks anyway for the replies!

liquidcms’s picture

i get this as well when i deleted a collection field which was giving me issues; now when i delete any other field (collection only maybe?) i get this error.

this should have been posted as a bug on the collection project.

Oceanman’s picture

I also see the items in my field_config and field_config_instance and they are marked as deleted(1). My fields also appear in the field_collection_item table of the database and this field collection is listed in other places in the database.

Normally you should not delete data from the database manually. Therefore, what is the proper drupal way to remove these fields from the database and consequently stop the errors? I do not want to mess up my database by doing this manually and missing something.

johnlaine’s picture

Appreciate you posting the solution, well immediate solution anyway.

huntr77’s picture

Just bumping this as I am getting this error too and i'm pretty sure it is because I delete some a Field Collection awhile back.

Does anyone know a clean way of removing these ghost fields as I'm a little uneasy manually removing things from the database?

ScratchFury’s picture

Just wanted to keep this thread alive! I got the same error after removing a field collection without first removing all fields in the collection. Fields were flagged as deleted, but not actually removed. Removing the corresponding field_name row from field_config and field_config_instance as well as the many corresponding field_name rows from field_collection_item seems to have fixed the issue for me...

Jaypan’s picture

I read somewhere just yesterday that fields are cleared on the next cron run. I'm not sure if that will happen in this case, but next time someone has this problem, a cron run would be worth a shot to see if that fixed the problem.

leex’s picture

Cron didn't fix for me.

ScratchFury’s picture

Perhaps cron removes deleted fields attached to nodes but not ones attached to field collections?

gdoteof’s picture

I had this problem from deleting a field_collection_item.

THe way to fix for me was

DELETE FROM `field_collection_item` where field_name="field_giving_error";

victory17’s picture

But I also had to run the mysql command on field_config and field_config_instance also

rp121’s picture

This did the trick for me. Thanks!