Hello -

One of my Drupal sites recently developed an odd behavior, where anytime a field is deleted the operation is completed successfully, but then an EntityFieldQueryException is thrown:

EntityFieldQueryException: Unknown field: field_event in EntityFieldQuery->addFieldCondition() (line 770 of /usr/share/drupal7/includes/entity.inc).

I tried to dump the caches and run update.php (incase something odd happened in the DB, I hadn't performed any updates), but neither seemed to make any impact.

Any help would be appreciated!

Comments

Hitby’s picture

Did you manage to work out what was causing this?

Thanks,

hillaevium’s picture

Unfortunately not.

Let me know what additional information I could supply to help out troubleshooting!

drupalok’s picture

me too...

Anonymous’s picture

Have exactly the same problem.

adelka’s picture

same problem...

perke’s picture

same here... i've created a fieldgroup and later removed it and after that each time i delete a field i get this:

EntityFieldQueryException: Unknown field: field_test_fielgroup in EntityFieldQuery->addFieldCondition() (line 770 of /includes/entity.inc).

_vid’s picture

More info on this issue here: http://drupal.org/node/1498746

2pha’s picture

I'm also having this problem

2pha’s picture

It seemed to be a problem with fields that were 'field collection' fields. After deleting the field collection, the fields remained. I had to delete the rows that corresponded to the field from the 'field_config' and 'field_config_instance' tables.

_vid’s picture

Thanks @2pha that solved it for me.

mkostir’s picture

Hi,
this worked for me as well.
I also did one more thing thou:
DELETE FROM `field_config` where field_name="my_badly_behaved_field";

cossimo’s picture

This also worked for me.

mo3.mo3’s picture

thx

realty.by’s picture

Thank you, Sir! your idea was very helpful!

cossimo’s picture

Same here...

Ganeshk74’s picture

Same problem.

sophiekovalevsky’s picture

I found a solution that worked for me.
Create again the field with the same machine name and with a field_collection type.
Then, create other field to test if you're able to delete without the message.
If you got the right message, you can delete the field_collection field and that's it.

kuserver’s picture

It works nice! Thanks!!!

Anonymous’s picture

I got this to work for me also, but I had to do a few extra steps:

I think i made this even more complicated because I had also deleted the content type that the field was attached to. When I tried this it didn't work the first time. So I recreated the content type with the same name, and then added a field collection with the name of the problem field. The first time I tried to delete, I got some funky error messages. So, I started over, and after I remade the field collection again, I *ran Cron*, and THEN deleted the field collection without any problems. Ran cron again, and the error messages had disappeared.

Not exactly sure if the content type had anything to do with it, I suspect it may have been running Cron first after remaking the field collection, and then deleting it.

RossP-1’s picture

The suggestions from 2pha above worked for me. Here's how I did it:

  1. Find the name of the badly behaved field from the Home->Administration->Reports->Recent Log Messages.
    You're looking for something like:
    EntityFieldQueryException: Unknown field: field_paerformers in EntityFieldQuery->addFieldCondition() (line 770 of...
    In my case the badly behaved field is "field_paerformers". Substitute your case for "my_badly_behaved_field" below.
  2. Check that the offending fields exist in the database:
    SELECT * FROM `field_config_instance` WHERE `bundle` = "my_badly_behaved_field"
    SELECT * FROM `field_config` WHERE `field_name` = "my_badly_behaved_field"
  3. Delete the offending fields from the database:
    DELETE FROM `field_config_instance` WHERE `bundle` = "my_badly_behaved_field"
    DELETE FROM `field_config` WHERE `field_name` = "my_badly_behaved_field"
acke’s picture

Worked perfectly for me! Thanks!

clcl’s picture

Thanks a lot!

jrusse27’s picture

This fix does the job! Thanks.