Skip to main content
Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.

Inconsistent Stack Height 1 != 0 NULL

By Ben Nadel on
Tags: ColdFusion

Yesterday, I got a ColdFusion error that I had never seen before:

java.lang.VerifyError (class: cftest212ecfm1626437113, method: runPage signature: ()Ljava/lang/Object;) Inconsistent stack height 1 != 0 null

That's certainly an error that sounds really bad. But, after some tag-context debugging, it came down to a silly commenting mistake. I had something like this:

<!--- Pick a random number. --->
<cfswitch expression="#RandRange( 1, 2 )#">

	<cfcase value="1">
		<cfset WriteOutput( 1 ) />

	<cfcase value="2">
		<cfset WriteOutput( 2 ) />


		<cfswitch expression="#RandRange( 3, 4 )#">
			I'll figure out these cases later. For now,
			just leave in the top-level switch.



I had a CFSwitch statement inside of the CFDefaultCase of an outer CFSwitch statement. I had meant to comment out the nested CFSwitch statement, but accidentally, I commented out the nested CFCase statements only, leaving in the nested CFSwitch tag. My scenario was one of nesting, but if you have any ColdFusion CFSwitch tag that does not have any CFCase tags, you will get a similar error. For example, if I had a page that only had a CFSwitch statement, I get this error:

java.lang.VerifyError (class: cftest212ecfm1626437113, method: runPage signature: ()Ljava/lang/Object;) Inconsistent stack height 1 != 2

As you can see, this time it's (1 != 2) rather than (1 != 0), but other than that, it's the same error.

Tweet This Deep thoughts by @BenNadel - Inconsistent Stack Height 1 != 0 NULL Woot woot — you rock the party that rocks the body!

Reader Comments

In FlexBuilder empty switch statement (without any case) gives:

An internal build error has occurred. Right-click for more information.

Without pointing out where the error exactly is. Nice :)


It must cause some errors!?!? There is no way in ColdFusion to have a CFSwitch statement that has nothing inside of it.... as far as I know.

There is nothing else on the page. I was able to reproduce in two pages.

Right. I got the error this time but I had to wrap my code in a cftry/catch block. Then I got this Error 500 which you stated. As soon as I removed my cftry block, I only got an empty page. I didnt try to investigate why I got the empty page when I should be getting the error but yes, we cant have a cfswitch without a cfcase, point noted. :) thanks.

WOW! This time I just came right to your site. I had pretty much figured it out but checked anyway with a search for that error. Sure enuff, you had the exact same answer I had pretty much guessed at.
I am doing a project on MX 7 and I was just trying out a menu switch. I have 2 switches inside of cfif/else blocks. I just put cases in 1 of the switches and wanted to see how it looked and worked. I got that error.
Being the brainiac that I am, I guessed that it was the empty switch. So I put in a default case but that didn't help so I did my search here, found I was right, and refreshed again and it worked.


Empty cases are fun... as are empty SQL statements - another thing that gets interesting with lots of conditional logic.