Skip to main content
Ben Nadel at NCDevCon 2011 (Raleigh, NC) with: Awdhesh Kumar
Ben Nadel at NCDevCon 2011 (Raleigh, NC) with: Awdhesh Kumar ( @kawdhesh )

Invalid token '\n' found on line 452 at column 0

Published in , Comments (1)

You ever get this ColdFusion error telling you that you can't have a line break at the end of your document? And then you start deleting extra white space having the ColdFusion compiler tell you that whatever your last document character is, it's invalid? This is an extremely frustrating ColdFusion error because it doesn't really tell you what's going on - if you don't really read the error information!

An invalid token error get thrown when ColdFusion is trying to finish parsing a TAG and either runs out of data (such as the end of the file) or hits a character (token) that is not allowed. For example, this:

<!--- This is a ColdFusion comment -->

... will throw an invalid token error when it hits the end of the file. Check out the open/close comments. The starting one is a ColdFusion comment tag opener but the ending one is an HTML comment tag closer. ColdFusion obviously ignores the closing comment as it doesn't care about HTML comments and continues parsing through the document looking for a closing comment tag (--->). Then, when it hits the end of the document without finding a closing comment tag it throws the error:

Invalid token 'X' found on line Y at column Z

... where X, Y, and Z are just variants (x = token, y = line, z = column).

While the "message" of the error is crap, please READ READ READ the rest of the ColdFusion error notes. The fine print will usually tell you what's going wrong. For instance, the above error will have this bullet:

The closing tag for the CFML comment is missing. Comment begins on line 267.

It's that easy. I know a lot of the times we see error messages and just start diving in, trying to fix things. But, why waste all that time when the debugging tells you exactly where the error is.

Want to use code from this post? Check out the license.

Reader Comments

I believe in love. I believe in compassion. I believe in human rights. I believe that we can afford to give more of these gifts to the world around us because it costs us nothing to be decent and kind and understanding. And, I want you to know that when you land on this site, you are accepted for who you are, no matter how you identify, what truths you live, or whatever kind of goofy shit makes you feel alive! Rock on with your bad self!
Ben Nadel