JavaScript exception on second Card Template:Preview

I apologise if this is a duplicate post: I searched the forum & haven’t found anything, but I may be using the wrong search terms.

If I edit the Card Template, navigate to Front, Back, or Styling, then tap Preview, things work as expected. If I remain within Card Template, navigate back to one of those first three categories, then return to Preview again, I get an error: **Error:** A JavaScript exception occurred. Thus, if I’m editing Styling, for example, & want to check back & forth on the effects of my CSS, I need to exit Card Template & re-enter after each round of edits. This error has been consistent since I began using AnkiMobile a year ago.

I am using AnkiMobile 25.02.02 on an iPhone 15 Pro Max running iOS 18.4.1.

I am able to reproduce this on AnkiMobile 25.02.2 [iOS 16.7.11]. Thanks for reporting it and thanks for posting such clear steps! :+1:t4: @dae will let you know if there’s anything else he needs

Hi everyone,

I encountered a bug in AnkiMobile that I wanted to report. Here’s the sequence to reproduce it:

  1. Open a note and go to “Card Template.”

  2. Edit the code in the template.

  3. Press “Preview” — it works correctly at this point.

  4. Go back and press “Styling” to make further edits to the CSS (I am not sure if the issue persists when trying “Front” and “Back” as well; hadn’t checked)

  5. Return to “Preview” — now an error appears:

Error
A JavaScript exception occurred

This seems to happen consistently after editing the card and trying to preview again once you’ve already previewed the card.

I am using an iPhone 17 Pro Max with iOS 26.2.1.

This was reported previously, so I’m merging it here.

Logged here: JavaScript exception when previewing & editing templates · Issue #13 · ankitects/ankimobile-issues · GitHub

I filed this error about a year & a half ago. I had hoped that it would be resolved in the new release. It has not been. I’m reporting again.

If you go Edit a card, go to Tools, select Card Template, tap Preview, return to make edits, then tap Preview again, you see nothing. Previously, this gave the error mesage **Error:** A JavaScript exception occurred. Now, it’s just a blank screen. I don’t do lots of formatting in AnkiMobile—I mostly use it for reviews—but I run into this problem once a month or so while making minor modifications to my layouts & it’s a bit of a nuisance.

I reopened your original thread and merged your post here. The dev team has a fix for this in the pipeline (along with several others), but unfortunately it had to be held back while we dealt with some Apple-required maintenance. It should be released in the next version – hopefully next month.