CardTypeError message is misleading

When I incorrectly change card templates in an add-on and try to save them, I can get an error message like this:

anki.errors.CardTypeError: Card template <U+2068>1<U+2069> in notetype '<U+2068>2. Mnemonics<U+2069>' has a problem.<br>See the preview for more information.

The error message is misleading, because it assumes it happens in the context of a note type editor where a preview is present, which is incorrect.

I suggest that Anki returns a more informed message when not in GUI, e.g., “Anki could not parse card template ⁨1⁩ in notetype ‘⁨2. Mnemonics⁩’ correctly. DETAILS.”

The bug ticket in my add-on.

3 Likes

I encounter the same error message too, and it is caused by a ‘{{SomeField}}’ reference of one non-existent field. The final reason is simple but it indeed takes me a long time to debug it…So I wish to have more details about the real error too.