Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On sites with field collections, there seems to be an issue surrounding field_collection items where I ran into the following error:
Ashoks-MacBook-Air:public ashokmodi$ drush -l ossr.site.dev ecl
Begin caching comment [ok]
Begin caching field_collection_item [ok]
WD php: Exception: Invalid field name given: field_version is not a Field Collection field. in [error]
FieldCollectionItemEntity->__construct() (line 119 of
/Users/ashokmodi/Sites/drupal/ossr/public/sites/all/modules/field_collection/field_collection.module).
Exception: Invalid field name given: field_version is not a Field Collection field. in FieldCollectionItemEntity->__construct() (line 119 of /Users/ashokmodi/Sites/chillco/ossr/public/sites/all/modules/field_collection/field_collection.module).
Drush command terminated abnormally due to an unrecoverable error. [error]
Needs some more investigation.
Comments
Comment #1
BTMash CreditAttribution: BTMash commentedWhat I thought was an issue in caching field_collection_item does not seem to be an issue due to the script (I tried it on 2 other sites which use field_collection and it ran just fine). It seems to stem from an older field collection issue (#1084268: Exception: Invalid field name given. in FieldCollectionItemEntity) so it may be a case of the inherited site that just happened to have this issue. I'm postponing this issue in the event that perhaps more people just need to test this out if they run into similar issues.
Comment #2
BTMash CreditAttribution: BTMash commentedIn my case, the solution ended up being http://drupal.org/node/1084268#comment-5881676 (there was stable field_collection_item data for a field that no longer existed). Once I removed that, everything was running correctly. So, problem existed elsewhere.
Comment #2.0
BTMash CreditAttribution: BTMash commentedRemove some unnecessary info.
Comment #3
BTMash CreditAttribution: BTMash commentedComment #5
stefan.r CreditAttribution: stefan.r commentedI recently ran into a site with the same problem, where 6 deleted field collection items still existed in the field_collection_item table. I had to run the following commands in order to fix this as entity_delete on the orphaned item_ids would just give me an error:
Should we add an update hook that does this? There is already an update hook that deletes orphaned items, perhaps something like this should have been in there?
Comment #6
stefan.r CreditAttribution: stefan.r commentedComment #7
Chris CharltonHow about
justalso documenting what [minimum] version of Field Collection doesn't get these errors?FWIW, the site I ran ECL on was using field_collection-7.x-1.0-beta8. Ouch, that's old.
Comment #8
knalstaaf CreditAttribution: knalstaaf commentedI'm still getting these in the current dev (2016-Jun-23), upgraded from 7.x-1.0-beta11…
Still have to delete the remaining field in the
field_collection_item
table (in the db), and removing the field with the corresponding ID infield_collection_item_revision
.Comment #9
jmuzz CreditAttribution: jmuzz commentedThere is at least one currently known cause of this: #2763395: Field collection doesn't delete children data .
If anybody knows another way this can happen in the current dev please provide steps.
Comment #10
knalstaaf CreditAttribution: knalstaaf commented