It's a bit hard to see from the stack trace what exactly is causing the crash. There is a mention of /home/karl/.local/share/cura/3.1/machine_instances/AnetA8WithInit.json however, have you tried moving /home/karl/.local/share/cura away and starting from scratch?
I suspect this is a bug in Cura or your custom printer definiton (or both). Can you attach the definition file?