Field Collection on node submit giving host entity error

1k Views Asked by At

I am working on a Drupal website. I created a content type with field collection. Field collection contaning 3 fields and is multiple. I have created lots of node of this content type successfully. But now when edit node and save them it gives me error: The host entity cannot be changed. in FieldCollectionItemEntity->updateHostEntity() (line 239 of /home/user/public_html/xyz/sites/all/modules/field_collection/field_collection.entity.inc).

Only some nodes are giving above error. Please help me to resolved this issue?

Let me know if you need further information about the issue.

Thanks!

2

There are 2 best solutions below

0
On

I resolved the issue myself. The issue was in database. I am not sure how but the nodes on which I was getting error contains the multiple entry for a field collection item id in multiple nodes. I delete the nodes and re-create with same data. Its working now. Hope it helps someone.

1
On

There are multiple different scenarios with Field Collection on Drupal 7 that can result in this error. See https://www.drupal.org/node/2382089