Fix traceback when ID declaration is numeric

Fixes #15913