Cannot continue if X-Callback tries to add a card already in the deck

Hello, I’ve been using Anki for a while now, mostly on iOS, to learn Japanese, and it’s been really awesome. Recently, I’ve been trying to use the Shortcuts app on iOS to add cards to my deck, which allows me to pre-fill them with information from various APIs. The current x-callback url schemes works amazingly for adding new cards, and I’m really thankful that it exists.

Unfortunately, if the card already exists in the deck, my shortcut cannot recover, since Anki presents the expected error. Duplicates are something that I expect to see somewhat often because of how I add every new character I see. For example, when I add a word like 今日 (Today), I’d add both its characters 今 and 日 to the deck too. Later, if I wanted to add 今晩 (Tonight), I’d get an error trying to add 今, which would stop execution before I try to add 晩.

I was wondering if there was a way to check for presence before adding, or some way to recover from this duplicate error (I did search the forums to learn that x-error / x-cancel haven’t been implemented).

If not, there are ways around it, but those methods are pretty complex and require me to store a copy of the first entry of all my cards.

Hopefully shouldn’t be too hard to address - I’ve added it to the todo list to look into

1 Like

Hey! Thanks for reading my post. I appreciate that you are putting this in your todo list!

In the meantime, I found a workaround that is pretty efficient, so I’ll use that until Anki has support for handling the error via x-callback.