DEV Community

James Moberg
James Moberg

Posted on

Misleading ColdFusion QueryAddColumn Error Message

While generating a ColdFusion query using QueryNew, I added a new column using QueryAddColumn and encountered a misleading error message.

The value of parameter 3, which is currently varchar, must be a interface java.util.List value.

Alt Text

The last time I checked, varchar was considered a valid "java.util.list value"... so what's the problem? In Adobe ColdFusion 8 or 9, I believe that the array parameter was optional. (I could be wrong.) If you omit the 4th parameter, the error message indicates that there's a problem with parameter 3 instead of the missing 4th parameter. I tested the same code using Lucee 4.5/5 and the new column is added without any error. (I also tested Railo 4 & the error returned was "Can't cast String [varchar] to a value of type [Array]".)

While a wrong error message is not a show-stopping bug, it doesn't provide any helpful assistance to determine what the actual problem is. Thankfully the online documentation ( highlights the array parameter as "required" (even though it wasn't for Lucee.)

Test it here

Source Code


20190103: I've reported it to Adobe. It's bug #CF-4206471

Top comments (0)