Use !r formatting instead of double quotes
Fix traceback when syncing custom types

This fixes a traceback which occurs when a rendering error occurs when
the top files are checked before custom types are synced.
Merge pull request #12897 from terminalmage/issue12883

Fix traceback when syncing custom types