Bonehead Custom Tag mistake

This post is more than 2 years old.

This one cost me an hour of my time this morning, and most of lunch. I can blame the earlier time on lack of coffee, but, wow, this was a dumb one.

I'm working on the ColdFusion Admin interface for Seeker, which is almost done by the way. From the list of Lucene indexes you can click to perform searches. This is handy when you want to build an index and then quickly test the results. I built out the UI and it basically came down to:

form code

if search has a value: cf_search dump results end if

Whenever I entered a search term, however, the page would reload back to the home page for the CF Administrator. I thought perhaps it was a simple error, but no amount of try/catch or cferror would fix the issue.

I took my search custom tag and removed all the code and just did "hi" and even that wouldn't work. Yet the exact same code worked outside the CF Admin in a test file.

I then tried cfmodule instead of cf_search and it worked. It was at this point I took a closer look at my code...

<cfmodule template="/stuff/search.cfm" stuff>

and noticed my file name.... search.cfm.

My file was calling itself as a custom tag. -boggle- In my own defense, I've used cfmodule for so long I've gotten a bit rusty with cf_ syntax.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by todd sharp posted on 6/4/2008 at 10:15 PM

Wow...I could see how that would take forever to debug!

Comment 2 by Jason Brookins posted on 6/4/2008 at 10:27 PM

I just finished up with one of those type of things yesterday. They always end up with the (only sometimes figurative) head-slap followed by the realization that you just burned many hours on your mistake.

Comment 3 by Sid Wing posted on 6/4/2008 at 11:50 PM

Ray - Glad to see I'm not the only one who suffers from "too much blood in the caffeine stream" issues. Taught me to never write code before my first cup of coffee (sidenote: also - never write code after more than two good, single malt, scotches - grin)

Comment 4 by Daniel D. posted on 6/5/2008 at 12:43 AM

Had a similar situation years ago at a former job. The common dev server that everyone used keep hanging 100% cpu. I asked everyone to tell me what they were working on so I could see what was causing the problem. Ended up going desk to desk and found that someone had made a page form.cfm and was trying to call a custom tag library that extended cfform call you guessed it cf_form. So had a recursive loop going and boom there goes the server.

Comment 5 by Tariq Ahmed posted on 6/7/2008 at 4:14 AM

I recently spent about 2hrs trying to figure out where in my code I was checking for malicious tags in textarea inputs that might make their way into the database, because it kept getting stored as InvalidTag - and I do have some checking going on, but couldn't figure out where that was coming from...

Then I did a search to see which 3rd party function I borrowed does that and came across one of your earlier posts... :)

http://www.coldfusionjedi.c...

Comment 6 by Nathan D posted on 6/7/2008 at 8:11 AM

For the last time, Raymond: come over the CFIMPORT camp. It's warm and safe here...

Comment 7 by Raymond Camden posted on 6/7/2008 at 5:09 PM

Heh, nice try there Nathan. ;)