First, the problem is 1.12.2, not version 1.17.1 because I can't find 1.12.2 version so I'm sorry, and then I'm not sure if other versions have fixed the bug, or if the problem is just a feature.
The Minecraft is not crash,only say:30e76ea4-edc4-4b63-83aa-a39063d3f994 不是一个有效的数字
*My Minecraft Language is Chinese, so that say Chinese
Now I know,the [type=villager] must be compact with @e
Please help me to close it