Here is another interesting bug to watch out for.

Imagine that you have defined an error template for your site:

<cferror type="exception" exception="ANY" template="wwwroot/error.cfm"

error.cfm looks like so:

<cfinclude a header>
do crap
<cfinclude a footer>

Now imagine header.cfm has

<cfscript>function foo() { return 1; }</cfscript>

When you have an error, you will either get the error NOT handled, or if you have defined a request error template, that one will fire instead.

Why? Because CF thinks you are trying to define FOO twice, which isn't allowed.

How do you fix it? Believe it or not, if you move the defintition of the UDF outside of the error page (or the cfincluded file) and put it in Application.cfm instead (or in a file Application.cfm includes), the error goes away.