upon restore, we get this error:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /autosave/restore/some-node-form/1326387480
StatusText: Service unavailable (with message)
ResponseText: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7409 of .../includes/common.inc).
Modules that may be relevant:
Autosave 7.x-2.x-dev
Entity 7.x-1.0-rc1 and API 7.x-1.x-dev 2012-Jan-10 (tried both)
Field collection 7.x-1.0-beta2 and 7.x-1.x-dev 2012-Jan-11 (tried both)
The node in question is made up of a number of fields and field collections. The fields vary in type and include file, image and text.
Comment | File | Size | Author |
---|---|---|---|
#30 | autosave_EntityMalformedException.patch | 1.73 KB | quicksketch |
#20 | autosave.module.patch | 1.61 KB | geek.de.nz |
#19 | autosave.patch | 981 bytes | geek.de.nz |
#16 | autosave.module.diff | 1.27 KB | geek.de.nz |
#13 | node-bug-fix.patch | 859 bytes | geek.de.nz |
Comments
Comment #1
Crell CreditAttribution: Crell commentedI don't see how this is autosave related. I think autosave is just triggering an existing but in Entity, but I really couldn't say. Refiling.
Comment #2
fagoThe error stems from core, not from the entity api module. Maybe this is a problem triggered by the autosave-field-collection combination though? Best check whether the problem appears without using field-collection too.
Comment #3
cjgriffin CreditAttribution: cjgriffin commentedI can confirm that the problem appears without using field-collection too. Without Entity or Field collection installed, I get the following on restore attempt (the only difference it seems from the original post is that the StatusText is Internal Server Error instead of Service unavailable):
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /autosave/restore/some-node-form/1327260091
StatusText: Internal Server Error
ResponseText: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7409 of .../includes/common.inc).
I'm using WYSIWYG and TinyMCE.
Comment #4
oobie11 CreditAttribution: oobie11 commentedThis is what I'm getting:
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /autosave/restore/my-node-form/1327998249
StatusText: error
ResponseText: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7409 of .../includes/common.inc).
Comment #5
Crell CreditAttribution: Crell commentedI still cannot reproduce. Can you post a backtrace from that point? (Find the line that throws the exception, and right before it call debug_backtrace() and dump the array it returns somewhere, then post it here.)
Comment #6
sillygwailoI got http://pastebin.com/5rt8ycc3 when putting debug_backtrace() before line 7389 in common.inc (Drupal 7.8). Autosave + Wysiwyg + TinyMCE on the Basic page content type with no special fields added.
Comment #7
sillygwailohttp://pastebin.com/uTiqcidc is a backtrace for Drupal 7.9.
Comment #8
sillygwailohttp://pastebin.com/PzmH3FyL updated for plain vanilla Drupal 7.12 (fresh install, nothing else enabled but the latest dev release of Autosave). Error is at line 7501 of common.inc this time.
Comment #9
CBIt appears, from a very brief investigation, that the page arguments are simply a sting of the node type, when the form in question is a node/add form.
So, for example, if you try to create a new node of type 'article' - autosave.module will send the string 'article' in the form_state args and drupal will treat that string as an object, of which it has no type or bundle association.
At the bottom of drupal_retrieve_form in form.inc ...
And, in node.pages.inc, you can see that it is expecting a node, not a string.
I'm happy to look further and try to create a patch, I just dont have time at the moment.
Hopefully this helps.
Comment #10
Crell CreditAttribution: Crell commentedI just got this exact same error on another site I'm working on that does not have autosave on it at all. The bug is with Entity API. Autosave is just doing something to trigger it (not sure what), as is whatever it is my site is doing.
In the case of my site, I have a series of node_save() calls (not even entity API related) in an install hook of a module, which is crashing when I try to install it as part of a profile.
Refiling.
Comment #11
sillygwailoI'm not convinced it's the Entity API module, since I get it on a brand new site, Standard install profile, only Autosave enabled, without Entity API installed.
(Updating the branch since the original report was for 7.x-2.x.)
Some more info:
As the #1 user, if I do the following:
I get the error originally-reported in a JavaScript popup.
If I visit autosave/restore/page-node-form/1331671331 (taken from the error message I got) directly in the browser, I get the following:
Comment #12
geek.de.nz CreditAttribution: geek.de.nz commentedI think I have a fix for this. Will let you know here when I have perfected it.
Comment #13
geek.de.nz CreditAttribution: geek.de.nz commentedIt's not beautiful I admit, but fixes this problem for me. I would like to be able to commit to this project. Can you make me a co-maintainer, please?
I would like to add some features and make this module better for our client but also for the Open Source world.
Thanks,
Tim
Comment #14
sillygwailoComment #15
Crell CreditAttribution: Crell commentedI do not understand what that code is doing or why. It needs a better explanation in code comments at minimum.
Also, you should not put your name or random extra braces around code blocks. The patch file indicates well enough what you are changing.
Comment #16
geek.de.nz CreditAttribution: geek.de.nz commentedSorry, it is a bit confusing but it hopefully makes sense now. It fixes the bug in my fresh Drupal 7.12 installation with no other modules enabled except for the standard set.
I would be very keen to become a co-maintainer at this stage because there are a few things I would like to do with this module for our web application/cms configuration, for example make it work with the CKEditor or better with the whole WYSIWYG module.
Comment #17
geek.de.nz CreditAttribution: geek.de.nz commentedNo one has applied my patch to the trunk and because I need to get this working asap, I made my own fork at
https://github.com/geekdenz/drupal-autosave
If you run into this problem, maybe you should try my fork.
Apologies to the maintainers, but you haven't reacted on/accepted my patch. I guess you are busy with lots of things...
Comment #18
Crell CreditAttribution: Crell commentedPatience, grasshopper. And please do not abuse the tag field.
The latest patch those still doesn't say what it's doing or why. The comments document what each line is doing, but that is useless. It is also incorrect format. (We almost never use end-of-line comments.)
What the code does not make clear is why we need to mess around with the menu field in order to avoid an exception thrown elsewhere. Looking at that, I have no idea why it's even relevant (especially since I cannot replicate the error in the first place) so I canot commit code the purpose of which I do not understand.
Comment #19
geek.de.nz CreditAttribution: geek.de.nz commentedSorry about the tags and the impatience, I hadn't read the guidelines properly.
Mh, you say you cannot reproduce it. Are you sure, you tried it with the 7.12 version of Drupal and the 7.x-2.x branch?
Because I can reproduce it with that in even the simplest possible case. I installed 7.12 with all the standard settings, turned on the module and get an exception every time I click the restore link, after of course making the necessary configuration changes to enable the module.
You do not understand the code? Given you seem to be quite a celebrity at Drupal I am a bit surprised by that.
How about this revised patch? With an even easier comment (hopefully).
Feel free to write it better, but please bear with me. I'm only trying to improve a great open source project.
I would feel honoured to become a maintainer. I think it would benefit Drupal and open source in general as well. What if something happens to you like it did to one of my colleagues last week: Poor Robbie. The bus factor as I'm sure you know it's called.
Comment #20
geek.de.nz CreditAttribution: geek.de.nz commentedOK, just to prove my patience and will to persevere, here another patch with the correct coding standard, at least as far as the coder review module can tell. Also, replaced a db_query call to db_query_range which included a LIMIT clause. Just to make it more portable.
There are still bugs with this module in this branch, but I'm slowly fixing them.
Regards,
Tim
Comment #21
sillygwailoComment #22
jyee CreditAttribution: jyee commented@geek.de.nz you shouldn't assign issues to yourself (or anyone else), unless you are a maintainer/co-maintainer of the project.
Comment #23
netw3rker CreditAttribution: netw3rker commented@geek.de.nz here are a few notes for you:
1) the line numbers of the patch are off by a bit. It looks like you rolled this patch against 7.x-2.0 and not 7.x-2.x-dev. you really should create the patch off of the dev branch.
2) I'm pretty the shortcut you used and commented out in the code here is fine:
3) the modification here isn't actually a modification (i believe this is called cruft. patches shouldn't contain cruft):
Beyond that, everything looks ok to me. The patch does apply cleanly to 2.x-dev and appears to work. the only issue I see is that once I click "restore" the autosave message that comes up says:
I'm not sure if it does that on sites that work correctly, so I'll assume that this is another issue & say that as long as the changes above get applied, its RTBC by me at least :)
Comment #24
Sill CreditAttribution: Sill commentedI too get this Malformed Exception error on restore. Here is the full code.
"An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /autosave/restore/page-node-form/1340142499/tbol9M319XUqLUURD_xfR6i6FgFnQpeJ0hrKTxwf8uY
StatusText: error
ResponseText: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7539 of /mnt/www/html/daniel5dev/docroot/includes/common.inc)."
I haven't applied the patch from #20 (geek.de.nz) as it isn't in full patch mode yet.
Comment #25
GHaddon CreditAttribution: GHaddon commentedAfter applying the patch from #20 to 7.x-2.x-dev version the problem seems to be solved. Cheers.
Comment #26
willmoy CreditAttribution: willmoy commentedSame as GHaddon. Problem exists on -2.0, the patch fixes it. Can post my .make file if that's helpful.
Comment #27
Crell CreditAttribution: Crell commentedI believe you guys, I just don't understand WHY it works. That's the part I still don't get. I want to makes sure that "why" is adequately captured in the comments so that it doesn't confuse other people later.
Comment #28
micheas CreditAttribution: micheas commentedI am pretty sure the why is that the form does not submit the bundle type as it cannot be changed, but bundle type is a required attribute of the node object being saved.
Getting the existing node, and then making the changes means that all the unchangeable attributes of the node object are submitted.
I would go with the patch in #20 as it catches all other immutable attributes (if they exist) of the node that have to be submitted with node_save() but are not returned with the form.
Comment #29
quicksketchThe documentation for node_add() makes this pretty clear: http://api.drupal.org/api/drupal/modules%21node%21node.pages.inc/functio...
Essentially the node_form() function *must* take a full $node object, not just the content type as a string. However the current patch only seems to *fix* the node/add/x form, but it *breaks* the editing of nodes at node/x/edit. This is because it attempts to convert the *already converted* menu item (a node) into a new node, which is unnecessary. I'm working on correcting this remaining problem so that the form properly saves both on addition and editing.
Comment #30
quicksketchI've committed this patch based on @geek.de.nz's work. Is this problem D7 specific? I'm mostly focused on the D7 version of the module, so if this problem applies to D6 also, lets backport it. However it seems like everyone here is just talking about D7. Thanks everyone for their input and patience on this one.
Comment #31
HongPong CreditAttribution: HongPong commentedThis may be a tangent but if you have malformed files entities - see #1446440: Unable to view me media management pages (EntityMalformedException: Missing bundle property...) for my one-off SQL fix for column type in the files_managed table.
Comment #33
dafederIf you're still getting this error and have our node/add page URL aliased, see #2298849: EntityMalformedException missing bundle after clicking Ignore
Comment #34
tisteegz CreditAttribution: tisteegz commentedStill getting this error when clicking restore, tried on multiple content type forms.
"ResponseText: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7929 of /../includes/common.inc)"
Autosave: 7.x-2.2+17-dev (2016-Jan-20)
Entity: 7.x-1.8
Drupal: 7.56