It seems that the question is being answered in commit: <https://sqlite.org/src/info/0d11d777c8d368f0>. This COUNT() aggregate function will be blocked in the ORDER BY clause in the later version of SQLite. Thank you for the fix and the information being posted in commit: <https://sqlite.org/src/info/0d11d777c8d368f0>.