New "unique" property of scheduled tasks causes queries produced by cfschedule to throw exception when joined in QoQ


It looks like recently a new "unique" key was added to scheduled tasks to prevent the same task from running multiple versions of itself at the same time. This key now shows up when getting a list of the scheduled tasks using cfschedule. We have code which takes this query and combines it with another query in a query of a query to produce a report that we display to the end user. Unfortunately it seems that when joining the query produced by cfschedule and our other query, there is an exception while trying to build the resulting recordset. It appears that behind the scenes, the column names for creating the resulting table are not escaped. The following code is a simplified way to demonstrate it:

cfschedule(action="list", returnvariable="tasks");
x = queryNew('task');

sql = "
select task
from tasks, x
where tasks.task = x.task

params = {};
queryOptions = { dbtype: 'query' };

try {
queryExecute(sql, params, queryOptions);
writeOutput('Success 1!');
} catch (ex) {


try {
queryExecute(sql, params, queryOptions);
writeOutput('Success 2!');
} catch (ex) {

In the first try-catch, the exception will be printed to the screen and in the second, "Success 2!" will be printed to the screen. We were upgrading from Lucee 5.2.9, where the "unique" key wasn't present in the query from cfschedule. I did confirm that in that version, having a "unique" key in a query made it unable to be joined to another query in a QoQ.

As far as quick workarounds, if the "unique" key isn't needed (which it is not in our case), then it can simply be deleted to make the query work as intended.


Windows 10; java 1.8.0_241; Server started with vanilla CommandBox


Michael Offner


Ryan Nibert



Fix versions


Affects versions