After activating cck_map for one of my content types, I got this error "While traversing node variables your recursion limit of 10 was hit 3 times" while trying to create the content template.

Could you please let me know what caused it? Thanks.

#32 contemplate_depth.patch804 bytesbrad.bulger
Members fund testing for the Drupal project. Drupal Association Learn more


timothymedia’s picture

I had the same problem when creating a content template with Contemplate. I have no cck_map, only regular CCK_fields. No solution found yet.

fallsemo’s picture

timothymedia - same here. Any solution to this?

ressa’s picture

I get almost the same error when I try to access a content type built with cck:
"While traversing node variables your recursion limit of 10 was hit 15 times"

rbryer’s picture

I also get the same error message, and the template does not appear to have all the node fields I would expect in it.

chrism2671’s picture

I have the same problem too. Has anybody made any progress on fixing it?

epicflux’s picture

Checkout this page on your site: admin/settings/contemplate

rbryer’s picture

Re #6. I set my recursion limit first to 15 then 20 then 25 and then 30 .... each time I get the same error, maybe will a few less hits. There is talk about this error on the contemplate issue list #230885: CCK activates triggers Fatal error and it seems that this limit has been added to prevent a fatal out of memory failure.

As far as I can tell this limit just stops the module from completely blowing the memory limits, but it still fails. There must be something else wrong with the code if it is causing such a deep recursion and this does not seem to be a solution, more a band-aid. I can't even figure out what my response to this error should be. Does it mean that the template code produced is incorrect? It just warns me and then lets me continue so I have no idea what the final result will be.

This issue also seems to be a duplicate of #268598: While traversing node variables your recursion limit of 10 was hit 15 times but there does not seem to be any satisfactory solutions on any post. I have had to remove the module.

This issue should be moved over to the contemplate issue list as I don't think it has anything directly to do with the cck_map module.

epicflux’s picture

Try setting the recursion limit really high, which will be a relative setting for each site, I set mine to 50, but I would set it to 1000 (and I just did) as long as I didn't get the white screen of death...

I think this setting was originally created to address an issue in Drupal 6 Contemplate, and was moved to the Drupal 5 version since it could help there too...

dugh’s picture

Project: cck_map » Content Templates (Contemplate)
Version: 5.x-3.3 » 5.x-2.02

I see the same issue trying to use contemplate.
I'm not using cck_map at all.

jrglasgow’s picture

epicflux is right in comment #8 - I added the recursion limit to fix #230885: CCK activates triggers Fatal error. This bug started occurring in D6. When traversing the $node object the php memory limit was hit. I don't know what causes it. This error will only appear on the contemplate edit page, no where else.

rbryer’s picture

I'm still unclear what this message actually means. Does it mean that the generate contemplate is invalid?

jrglasgow’s picture

All this error means is that when Content Templates modules attempts to show you all the parts of the $node variable(in the box below the template) it is using recursion to show you parts of the $node. When the $node is excessively large traversing the $node uses a huge amount of memory (especially since we do it 3 times). We have a user defined setting to set the recursion limit. This error tells you that the recursion limit was hit. This error doesn't mean there is anything wrong with the node or the template, it is just telling you that you may not have all the possible options shown for the $node variable in the variables box. There is no problem that will occur when the nodes are displayed using the template, or when editing the template.

I added this recursion depth limit to prevent White Screen of Death when the PHP Memory Limit is hit which is a FATAL error. I could have limited the recursion depth silently, but I wanted to let the user know that he/she may be missing some parts of the $node variable.

SocialNicheGuru’s picture

I went back to the last rev of contemplate and eh problem is gone 5.x.1.9.


jrglasgow’s picture

Assigned: Unassigned » jrglasgow
Category: bug » task
Priority: Critical » Minor

I will change this from an error to a notice.

Pixelstyle’s picture

Why is this a minor issue when some template variables aren't visible? It doesn't stop completed content templates from functioning, but it can make it really hard to make new ones.

jrglasgow’s picture

Status: Active » Fixed

This notice informs you when you aren't seeing the whole variable, it gives you the opportunity to change the recursion deph limit to see more of the variable. On the 2 or 3 times the limit is hit it is because the $node variable has a recursion problem and the variable information that is left out is in the $node variable somewhere else where it is already displayed.

I have fixed the code so this does not appear as an error, but as a notice. The changes will appear in the next releases og Content Templates for D5 and D6.

trevorleenc’s picture

ok, is it just me, or am I missing something...

I am on d5.8, and just upgraded to contemplate 2.02, and I don't have a "admin/settings/contemplate"

trevorleenc’s picture

disregard last comment...I just emptied my cache* tables...and all was right with the world..

dugh’s picture

When do you plan to release this, it pretty much makes contemplate unusable. Also, how can you increase the recursion limit.

Jehf’s picture


I'm seeing this, too.

Previous experience (not in Drupal, where I'm an utter newbie, so this may be ign'rnt) makes me wonder whether the node hierarchy is looping back on itself which, if you're not watching for it, could cause you to run out of memory no matter how high you set the limit.

For instance, I'm using the Node Reference and Node Auto Term (NAT) modules, both of which probably create some very complicated object trees.

Just guessing...

AD-DA’s picture

May I suggest a more informative error message?

"While traversing node variables your recursion limit of XX was hit YY times. This means that you may not see all available variables in the "Body Variables" sections below, however it will not affect the display of nodes with the templates defined here. You may increase the recursion limit in the admin/settings/contemplate Contemplate Settings page."

Terebinth’s picture

Saw this annoying error too and thought '''what now....''

Totally agree with Andjety ..... a more informative error message would have saved me some anxiety and time in trying to figure out what 'went wrong'.....

Phillip Mc’s picture

having the same problem.

anyone know what recursion limit is too high?

Or is there a benchmark for the amount of memory you should have availabile for, let's say, a limit of 20?

rbryer’s picture

In my experience you can keep setting it higher and it will just take longer to reach the new limit, and then throw the error anyway. I can set it to 200 and it will still hit it. There is a more fundamental issue here with the data structure of some of the node details. I use og_groups and it appears to contain data structures that reference other elements at the same or a higher level. This causes the recursion to loop until it hits the limit and then fails anyway.

Its hard to say what is at fault here.

Phillip Mc’s picture

As a suggestion, would it be an idea to add a checkbox to the contemplate.module settings page for "basic", and "indepth" recursion?

In other words, a basic recursion would just load up a list of the basic node and cck variables, rather than the kitchen sink approach, where the module tries to recurse through everything and then some.

For advanced, it would go a level deeper, where it would display example variable strings, like it does now by default. 9 times out of 10 I will know which variable names I need to use just by looking at a list and if I'm stuck, I can switch to the "indepth" mode.

The point is that I and I imagine most others probably mostly use the contemplate.module for moving node and cck variables around in the teaser/main body, so the 'indepth' recursion that contemplate presents at the moment, maybe a bit of an overkill and just being presented with a list of the variables availabile to your node is enough. The current way it works is useful, but, if that's where the recursion limit issue is coming from, it maybe something you just use now and again, when you're stuck, or if you are having difficulty identifying a particular variable.

Any thoughts?

It's a great module and while it is a relatively minor error, it would be great to see it sorted.

eric.chenchao’s picture

Version: 5.x-2.02 » master

I just add a imagefield (in drupal 6 with CCK2.0-rc5) and recursion limit of 10 was hit 80 times

So I closed to $node->content in admin/settings/contemplate page

Oliver Huynh’s picture

Agree with u, Philk!

grah’s picture

+1 for Philk's suggestion.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

drupaloo’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

I got the same error:

While traversing node variables your recursion limit of 10 was hit 117 times. For more information about this error goto This error will not effect the operation of Content Template, but it may not show you all available variables on this page. This error will only appear on this page.

I ain't no high falutin PHP programmer and having read all the above posts, I get the impression there is no definite fix for this, only to set the limit higher, but it has not been defined what the new limit should be, and if it still gets exceeded, what the cause is, and what the resulting problems are, such as possible data loss.

If I misunderstand this, please excuse me. If this is correct, please fix it, or at least provide an explanation.

BTW the path admin/settings/contemplate can also be reached at Home :: Administer :: Site configuration > Content Template Settings

drupaloo’s picture

Priority: Minor » Critical

I set the limit to 20 and got:

While traversing node variables your recursion limit of 20 was hit 2151 times. For more information about this error goto This error will not effect the operation of Content Template, but it may not show you all available variables on this page. This error will only appear on this page.

Again, I am not sure what this implies, but Drupal got real unresponsive, and so I dont feel comfortable using Contemplate.

brad.bulger’s picture

804 bytes

There seems to me to be a simple error in the code that is causing spurious complaints about hitting the recursion limit.

in the contemplate_array_variables() function, when going through the values, when it makes another call to contemplate_array_variables() (thus going one level deeper), it is *incrementing* the $depth variable as part of the function call. so the depth of the first array value at a given level will be 3, say, and then for the next value of that same array, at the same level, the depth will be 4.

it should be only adding 1 to the value of $depth in the function call, not changing it (which is what incrementing it will do).

i have patched this and the error goes away, without ever encountering any kind of memory problems.

am i seriously misunderstanding something?

jrglasgow’s picture

I have committed this to D6 and D5, and released a new version. Hoping this finally takes care of this problem the new release is 6.x-1.0

drupaloo’s picture

I thought I would revisit the module and I do not experience the problem with 6.x-1.0.

Thank you very much for resolving this!

nirad’s picture


getting this error with Contemplate 6.x-1.1 and CCK 6.x-2.3

SocialNicheGuru’s picture

(deleted comment)