Fix traceback when ID declaration is numeric

Fixes #15913
Merge pull request #16002 from terminalmage/issue15913

Fix traceback when ID declaration is numeric