Vim CursorHold autocommand error when opening command line window

Trouble

When opening the Command-line window in Vim (q: in Normal Mode) I was getting the following error:

Error detected while processing CursorHold Autocommands for "*":
E11: Invalid in command-line window; <CR> executes, CTRL-C quits: checktime

Context

This is most likely to happen if you have in your .vimrc, or if one of your plugin is running, such an autocommand: autocmd CursorHold * checktime.

Solution

Googling for a bit I came across this closed issue of vim-polyglot Github repository that provides the solution.

Just add silent! between * and checktime and that's all, the warning should just silent out.
You may have to not only reload your .vimrc, but to also quit and re-open Vim for this change to take effect.

Once again here is the fix:

Before:

autocmd CursorHold * checktime

After:

autocmd CursorHold * silent! checktime