There is too much code inside the template


Another developer I know created an old-fashioned form with many fields on the screen. In the cfml source code, it makes a lot of loops to generate the fields with their default value, a lot of calls to CFCs and others, generate the HTML and so on. At some point, Lucee generated this error:

There is too much code inside the template. Lucee was not able to break it into pieces, move parts of your code to an include or an external component/function

He got around it by reorganizing the code a bit, but I’m curious if there was another solution, like a special option in Lucee Admin like “Dude, try harder when you have a gigantic template to devour” or a tag to insert in the template.

Thank you

Post your code that would help everyone attempt to figure out where Lucee is breaking.

It will not be possible to post the code here. My question was more theoretical, namely if Lucee limits the amount of code in a single template. It seems not only determined by the number of lines, but also by what’s happening in the code, like loops, number of variables…

I encountered a similar problem when working with Adobe Coldfusion. In fact, it’s more or less a problem in the sense that it’s up to the developer to better organize their code and not put everything in the same template. Except I was curious how Lucee determines that there is too much code in a single template. I’ll take a look to see if I can find this error message in the Lucee source code…

I found this. But it’s part of a try catch and I don’t know how to find out more.

I would guess, and this is just a wild guess. if you put this on a massively fast ultra high memory version of tomcat you may never see this error, even if the template had lot of “work” on it.

something very low level such as max open files or max process threads consumed by file operations would come into play more than Lucee or Coldfusion just crashing.

Would be interesting to see how far up it goes and what code would trigger this.

1 Like

Why would you not take on board the implied advice, and just… refactor yer code a bit?

If yer code is tipping those particular scales, it’s a sign the code could do with some attn, rather than Lucee needing to do anything differently.

At the end of the day, there’s an upper size limit on a compiled class; that comes from Java, not Lucee. Obvs the way Lucee transpiles the CFML into bytecode has impact on this, but I bet it’s about as efficient as Micha can make it.

Just… improve yer code a bit…


Oh I completely agree with you. As I said previously, this is not my code and I also believe that it is better to optimize/reorganize the code.

I’m not asking for Lucee to change either. My question was simple curiosity as to how Lucee/Java judged code to be too big.

This might be interesting reading:,can’t%20exceed%2065535%20bytes.

I had the mistaken understanding that it was the size of the class that was the problem. Size of the method, apparently.

All my other googling points back to it being an issue with… ahem… auto-generated bytecode, and not really an issue with hand-cranked code.

Of course all CFML source code auto-generates bytecode when transpiled. Cough.

Looking further, it’s something to do with with memory addressing offsets. It’s pretty low level in the JVM.


Great! Thank you for sharing this and for your time!