I'm creating some terms with the taxonomy_term_save function but i'm getting the following error:
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7389 of /var/www/cmd/sitiocmd/code/includes/common.inc).
This didn't happen with the 7.7 version of Drupal core. Any help?
Issue fork drupal-1270340
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
girishmuraly commentedMarking as duplicate of #1266620: Missing bundle property on entity of type file error
Edit: In particular see comment http://drupal.org/node/1266620#comment-4941950
Comment #2
mburak commentedI'm sorry but I applied the patch in commons.inc and still having the problem.
This is the content of the entity when I get the error:
Perhaps something with the taxonomy module?
Comment #3
Remon commentedNot sure if this issue is a duplicate. As stated above, the missing "taxonomy_term", neither media or file stuff.
Comment #4
Remon commentedNot sure if this issue is a duplicate. As stated above, the missing "taxonomy_term", neither media or file stuff.
Comment #5
girishmuraly commentedWould be better if more detail can be added about the issue, in particular how to reproduce it and how its different from the other already open issues.
taxonomy_term_save() works. Perhaps check the vocabulary object or any other property of $term that you pass in. Its possible that the vocabulary is not yet created.
Comment #6
damien tournoud commentedThanks for your report, but this is not a bug.
... because this is an invalid term. The vocabulary_machine_name is invalid. Feed a proper machine name or don't set this key.
Comment #7
j0rd commentedI get a similar error on my site (both 7.7 and 7.8).
For me, it's very easy to duplicate. I have a node with the preview option enabled. If I preview, then preview again, I get the error I posted above.
Not exactly too sure what the problem is, but may be related.
Comment #8
Remon commented@j0rg, #1259916: Load reference fields when building content might be helpful
Comment #9
j0rd commented@Remon, thanks I'll take a look at those patches.
Comment #11
damienmckennaI closed two duplicates of this issue:
Both described the exact same problem.
Comment #12
damienmckennaAnother issue, #1290666: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in function entity_extract_ids()., identified the same problem but had the following solution from fexmusicmutuz:
Comment #13
giorgoskget same error after updating my site from nov 2011 version to lateset versions (drupal,commerce,views, entity, rules etc)
the error comes up when trying to edit a commerce product with taxonomy terms attached
I traced with netbeans debugger and find that
$info['entity keys']['bundle'] is "vocabulary_machine_name"
and $entity does not contain "vocabulary_machine_name" as an attribute
thus the expection is thrown all the time not letting me edit the product
the following is DIRTY HACK that gets my work done untill this is resolved
following modification does not throw the exception when the $entity_type is "taxonomy_term"
which is always true in my case
any suggestions ?
Comment #14
giorgoskactive for anyone who has faced this before
Comment #15
Aurochs commentedHave same errors when addressing taxonomy terms pages but only those terms which are attached to nodes of non-ubercart content types...
Comment #16
Aurochs commentedI just solved the problem by editing context filter in terms page standard views form.
Looks like it happened due to wrong view filtering.
I chose all terms - any vocabulary but wanted to show ubercart field in the view so i guess that was the reason. No ubercart fields for the veiw at pages not belonging to ubercart
so finally i made terms view to be valid only for ubercart pages and other pages to work via standard display
Comment #17
kclarkson commentedI have just updated to Core 7.17 and am now receiving this message.
There are so many issues regarding this I cannot keep them straight nor have I found a solution that works. Sad that I must restart a project :(
Comment #18
giorgoskIn my case it turned out that terms data were corrupted by a wrong import using feeds
I put following code in my template.php and used it only when I was getting corrupted terms
it deleted all terms that were not assigned to a vocabulary and it solved the problem
might be helpful to someone
Comment #19
kclarkson commented@GiorgosK
Thanks for the quick reply. I looked at my database and it appears as though all of my terms have a VID but they don't have a UUID. I used your code and placed it into my template.php file but it just gave me an error.
Any other suggestions ?
Below is an error I am seeing when trying to create a "new" view the following popup shows:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /admin/structure/views/view/tester/preview/page/ajax
StatusText: error
ResponseText: EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7646 of opentel/includes/common.inc).
UPDATE: I am not receiving this error when I use fields in a view format option. Every other option, content, display suite, rendered entity etc.. shows this error. So I am going to assume it is an issue with entity's .
Comment #20
kclarkson commentedI found a fix today from another issue. #1281114: Database records not deleted for Term Reference Fields after Term is Deleted
It uses the Taxonomy Orphanage Module because the taxonomy terms references are not deleted from the database it causes the error.
There are other modules that do the same for other Entity reference as well. Def should link this page.
Comment #21
William Aubert commentedHello,
I have the same message on all my sites since I did the 7.17 update.
The problem occurred only on the /taxonomy/term/all page (after the launching update.php file) :
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7562 of /var/www/domain/includes/common.inc).
I tried the Taxonomy Orphanage Module and the field_reference_delete Module... but this has not solved the bug.
This is strange because the taxonomy view worked fine before.
Comment #22
kclarkson commented@william@studio
Have you tried re-creating the taxonomy view ? Don't clone, just try creating the view after the update.
Comment #23
William Aubert commentedThank you for the answer. This is the default core taxonomy/term% views. I disabled it and I created a new one, but I still have the error message.
I tried to revert it, but the error is still there
This error is on all my D7 sites.
Comment #24
William Aubert commentedI think I found it !
After searching all weekend, I decided to restore the database for one of my sites. Luckily I had daily backups. So I think I found the problem this way.
The correct version was more than 15 days, when I updated two modules including entityreference (7.x-1.0-rc3 to 7.x-1.0-rc4).
I have not solved the problem on my other sites because I'd prefer only downgrade this module and don't restore all database.
But I don't know the good way to safely downgrade only this modules. It could confirm that this module is causing my error.
Comment #25
William Aubert commentedBad news, I think I spoke too soon...
Everything seemed to work fine until I decide to disable a module this morning.
When I update, disable or enable a module, the error appears again.
This is very strange, I can't identify the causes of the problem...
Comment #26
William Aubert commentedHello,
I have not succeeded in solving my problem ...
In database, I can see this watchdog line just after the error message on the site:
wid:37301
type:php
%type: !message in %function (line %line of %file).
severity:3
link:
location:http://www.domain.com/taxonomy/term/all
-edit- Indeed, the problem occurred after updating several modules (include Meta tags 7.x-1.0-alpha8 to 7.x-1.0-beta2).
-edit- My actual solution is to apply this patch.
It looks working !
Comment #27
kerasai commentedThis occurred for me while programmatically saving taxonomy terms using taxonomy_term_save(). The issue for me was not having a valid vid property set on the term object. Hope this helps you all figure this one out.
Comment #28
sutriadi commentedI dont have meta tags module installed, but i encountered this problems.
I've drupal 7.19, entity module and entityreference module installed.
Comment #29
sutriadi commentedComment #30
LTech commentedI have this error EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7633 of /home/xxxpublic_html/includes/common.inc).
The website encountered an unexpected error. Please try again later.
The site was fine until I installed the media module. So I uninstalled the media module and now when I try and use wp_blog I get the above error.
Comment #31
marcoka commentedsame here. metatags disable. error gone
Comment #32
deastlack commentedEntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() (line 7633
I get the above error whe attempting to create a container of forum using the Advanced Forum module
Comment #33
seaneffel commentedMaybe related to all your problems, I have isolated my matching error messages down to bad term reference fields. At some point it started crashing out when attempting to preview nodes while a term reference field contained any value. If the field had no value, preview just fine.
After isolating this problem to one specific term reference field, I then created an identical new field with the same name and configs. The new field previews without issue.
Mad science alert! I then found my two fields in the "field_config_instance" table and I copied the "data" column from the new field into the bad field. Now the preview step works like a charm. I have a feeling that there is some old dead code in the bad field left over from a sloppy module update. I don't claim to understand it and I'm not smart enough to look at these strings of values and see what the bad egg is, but I thought I would post this for anyone else to learn from.
Bad field:
Good field:
Your field values will look different than mine, but maybe you'll see a pattern. Hope this helps someone.
Comment #34
Yorgg commentedI also have the same as #30
EntityMalformedException: Missing bundle property on entity of type taxonomy_term. in entity_extract_ids() line 7633 of /includes/common.inc
Comment #35
bpadaria commented@staminna
https://sites.google.com/site/learnandmake/entitymalformedexception-miss...
Solution mentioned at above link worked for me.
Comment #36
orbrob commentedI'm having this issue as well. It only happens on our production site which is using several caching layers: APC, memcache, & varnish. This is also on a LEMP stack (nginx). Pushing the most innocent 3 line module (hook_form_alter) can cause this. I don't think that hook had anything to do with it though, and this isn't the first time we've turned on a new module and seen this appearing in our logs endlessly. It's a major issue as the site comes to a hault on a server with 32 GB RAM & 12 dedicated cores. So, I started researching. I've implemented the change at #35 and have not had the chance to test turning on a module again.
@seaneffel - I tried to look into the difference of those field instances and started by converting them into arrays to make them easier to look at. When I convert the "bad" string, I get:
Notice: unserialize() [function.unserialize]: Error at offset 242 of 633 bytes in C:\xampp\htdocs\serialize.php on line 12So either it was a bad paste, or it's a bug. Whether or not that bug is related to this, I couldn't tell. But from the strings it looks like the "good" string is just missing the "teaser" view mode settings.
EDIT: Forgot to mention, the way we fix it involves restarting php-fpm (for APC clearing), mysqld, and memcached. Sometimes a couple times and then it goes back to normal with the newly included module.
Comment #37
marcopbazz commented#35 solution worked for me, thanks!
Comment #38
Turies commentedIn my case it was fileaccess module.
Comment #39
dgtlmoon commentedYeah this seems to be caused by other modules
Comment #40
lmeurs commentedI ran into the
EntityMalformedException: Missing bundle property on entity of type taxonomy_termerror as well, it took me half a day and it drove me nuts. Eventually the problem appeared to be... me!I use a field on a taxonomy vocabulary, in my template file I implemented
MY_THEME_field(). In this function I render this field depending on the value of another field. I got the other field's items using:The passed element object is the taxonomy term the field belongs to.
This worked fine, until I started using this field not only on a taxonomy vocabulary, but on a node type too. Now the element object is a node, but the passed entity type still is
taxonomy_termwhich causes the error in my case.What helped me was placing the PHP's
debug_print_backtrace()in thecommon.incfile right before the error is thrown to get a backtrace of all the functions.Best of luck to anybody struggling with this error!
Comment #41
orbrob commentedI installed https://drupal.org/project/taxonomy_orphanage and that fixed the problem. I put a few debugging statements in while this module did it's thing and found one node/field combo in particular where most of them were. It made sense because someone had just been "organizing" that area of the site. This error happened because the user went in and deleted the terms, but never went back and updated the nodes to remove the reference to that term. I imagine the error might not have happened if we were not also outputting the term reference field.
I'm almost sure I'm missing another element in how this happens because I could only see the error happening after a cache clear. We run a stack with memcache & varnish to further complicate things and could never reproduce this in a dev environment with all caches disabled. Non the less taxonomy_orphanage has fixed the root of the problem.
Comment #42
marcoka commentedi tested deleted the taxonomy field causing this and recreated it, so no ghost/missing terms. i then realized it only happens with a taxonomy term reference field.
related
#1697284: EntityMalformedException: Missing bundle property on entity of type taxonomy_term
my solution was to deleted the field AND the whole taxonomy vocabulary. reacreated both. now its workingok that did not fix it. but i now know why it worked. it worked as long as i displayed the field on the node page. the moment i removed the field on the "display" tab of the node type. well there is the error again.
Comment #43
bfodeke commented#42 fixed my issue. Thanks for the obscure fix, I'd have never figured that out as a quick fix
Comment #44
egfrith commentedThere's a patch that cures this issue for me at #1697284: EntityMalformedException: Missing bundle property on entity of type taxonomy_term.
Comment #45
dgtlmoon commentedSee #1697284: EntityMalformedException: Missing bundle property on entity of type taxonomy_term
Comment #46
swiftsystems commentedThank you GiorgosK for comment #13.
The dirty hack worked beautifully for me lol.
I also had the "vocabulary_machine_name" $info['entity keys']['bundle'] with the $entity->vocabulary_machine_name not being set.
Here is a patch file for common.inc for those who need the quick fix.
Comment #47
axhussain commentedI was experiencing the same error with the following code:
But I resolved the issue by turning $term into a class instead of an array:
Hope that helps somebody else.
Comment #48
subir_ghosh#19 fixed it for me. I was getting the error while accessing the Categories tab under Total Control Dashboard.
Comment #49
bobburns commentedStill there in version 7.64
Can someone commit this fix at #46 to core please ??
It works fine
Comment #50
damienmckennaPlease see #2128265: Term field not displayed + Notice: Undefined index: taxonomy_term in taxonomy_field_formatter_view() (line 1596 of taxonomy.module) which is the current open issue related to this problem.