[Quick 12.0.4 + QB 13.0.3] QB Randomly Queries Wrong FROM Table

I brought this issue up on Slack a few months ago, but wanted to post here on the community forums in case anyone else experiences a similar issue with Quick + QB where it randomly queries the wrong database table for an entity.

This issue tends to occur on high-traffic web apps and is unfortunately not easily reproduceable. I wind up getting a handful of error notifications each week so it’s happening enough where I’m concerned, but not regularly enough to be able to reliably capture what’s going on or simulate it in the staging or development environments.

I’m using ACF 2021 (latest) in production if that helps.

Here’s an example in a Coldbox 7 Handler:

// handlers/Quotes.cfc line 186  
prc.quote = getInstance( "Quote" )
	.where( "saleRefNbr", "=", rc.saleRefNbr )
	.firstOrNew();    

The exception is: Error calling v1:quotes.save: Error Executing Database Query. [Macromedia][SQLServer JDBC Driver][SQLServer]Invalid column name 'saleRefNbr'.

Needless to say, the table column exists in the “Quote” table and this code works 99% of the time.

Most of the Stack Trace:

Here’s what I’ve tried:

I’ve set up try/catch statements in other areas of the app where this happens to try and get the raw SQL from QB. What I’ve noticed is that the SQL statement looks good except for the FROM statement, which will reference a different table, like “product” instead of “quote”.

Unfortunately, since I can’t replicate the issue reliably, I can’t figure out what’s going on and why this keeps happening.

@elpete I have an update on this issue, and as it turns out, it is the result of an Adobe ColdFusion engine scope contamination bug, reproducible in ACF 2023 and 2025.

I created a repo for Adobe and they are currently working on resolving it.

During my investigation, I discovered some possible workarounds that could be implemented in Quick + QB to bypass the bug. If you’re interested in the workaround patches, let me know and I can share or create PRs. Otherwise, we can hope Adobe fixes things soon.

Note: Lucee 6 and Boxlang do not appear to be impacted.