# Special Fields error on 2.1.30

**URL:** <https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203>\
**Category:** Help\
**Created:** [August 12, 2020, 12:48pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203 "2020-08-12T12:48:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [August 12, 2020, 12:48pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/1 "2020-08-12T12:48:34Z")

</div>

@dae is this something that needs to be updated again? I can’t reproduce it myself yet, but multiple others have had this issue

UPDATE: I’ve now had 5-6 people email me with the same issue. They seem to be able to use special fields just fine on 2.1.26. This issue occurs when importing a brand new deck and if they switch profiles, they can import fine without any issues. Turning all add-ons off except for special fields does not solve the problem. I have no idea what the issue is. If the add-on needs to be updated, please let me know and I’ll talk with John and/or @Arthur

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/5/55f157d339e87ddc79792c90a679c2e477d0ecc4.png)

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [August 13, 2020, 8:37am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/2 "2020-08-13T08:37:20Z")

</div>

Assuming it only happens when the add-on is active, then it does look like it needs to be updated - it appears to be saving an old version of a note type that something else already modified.

Edit: note that this issue likely existed in .28 and .29 as well - I don’t think any recent changes would have suddenly broken this.

---

<div class="post-metadata">

**Author:** ![Mau](https://avatars.discourse-cdn.com/v4/letter/m/ac8455/32.png) [@Mau](https://forums.ankiweb.net/u/Mau)\
**Post date:** [August 13, 2020, 11:04pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/3 "2020-08-13T23:04:16Z")

</div>

Erro  
Ocorreu um erro. Por favor, vá para Ferramentas \> Verificar Banco de Dados para ver se isso corrige o problema.  
Se o problema persistir, por favor relate-o em nossa página de ajuda. Copie e cole a informação abaixo dentro de seu relatório.  
Anki 2.1.30 (06a69c25) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1  
Platform: Windows 10  
Flags: frz=True ao=False sv=1  
Add-ons, last update check: 2020-08-12 20:32:11

Caught exception:  
Traceback (most recent call last):  
File “aqt\webview.py”, line 493, in handler  
File “aqt\editor.py”, line 485, in   
File “aqt\addcards.py”, line 189, in \_addCards  
File “aqt\editor.py”, line 597, in saveAddModeVars  
File “anki\models.py”, line 87, in save  
File “anki\models.py”, line 231, in update  
File “anki\rsbackend\_gen.py”, line 414, in add\_or\_update\_notetype  
File “anki\rsbackend.py”, line 265, in \_run\_command  
anki.rsbackend.InvalidInput: InvalidInput { info: “attempt to save stale notetype” }

---

<div class="post-metadata">

**Author:** ![guillempalausalva](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/guillempalausalva/32/34258_2.png) [@guillempalausalva](https://forums.ankiweb.net/u/guillempalausalva)\
**Post date:** [August 14, 2020, 9:25am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/4 "2020-08-14T09:25:49Z")

</div>

That error may be coused by Special Fields add-on. Can you reproduce it without add-ons? (hold shift down when starting Anki)

---

<div class="post-metadata">

**Author:** ![mjggoldman](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@mjggoldman](https://forums.ankiweb.net/u/mjggoldman)\
**Post date:** [August 4, 2020, 8:48pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/5 "2020-08-04T20:48:52Z")

</div>

Import failed. Debugging info:  
Traceback (most recent call last):  
File “aqt/importing.py”, line 403, in on\_done  
File “concurrent/futures/\_base.py”, line 432, in result  
File “concurrent/futures/\_base.py”, line 388, in \_\_get\_result  
File “concurrent/futures/thread.py”, line 57, in run  
File “anki/importing/apkg.py”, line 44, in run  
File “anki/importing/anki2.py”, line 41, in run  
File “anki/importing/anki2.py”, line 64, in \_import  
File “/Users/matthewgoldman/Library/Application Support/Anki2/addons21/1102281552/ **init**.py”, line 72, in newImportNotes  
shouldAdd = self.\_uniquifyNote(note)  
File “anki/importing/anki2.py”, line 189, in \_uniquifyNote  
File “/Users/matthewgoldman/Library/Application Support/Anki2/addons21/1102281552/ **init**.py”, line 255, in \_mid  
self.dst.models.update(model)  
File “anki/models.py”, line 231, in update  
File “anki/rsbackend\_gen.py”, line 414, in add\_or\_update\_notetype  
File “anki/rsbackend.py”, line 265, in \_run\_command  
anki.rsbackend.InvalidInput: InvalidInput { info: “attempt to save stale notetype” }

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [August 5, 2020, 1:00am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/6 "2020-08-05T01:00:07Z")

</div>

Can you reproduce it without add-ons?

[https://faqs.ankiweb.net/when-problems-occur.html](https://faqs.ankiweb.net/when-problems-occur.html)

---

<div class="post-metadata">

**Author:** ![insanegam3r](https://avatars.discourse-cdn.com/v4/letter/i/cdc98d/32.png) [@insanegam3r](https://forums.ankiweb.net/u/insanegam3r)\
**Post date:** [August 14, 2020, 5:43am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/7 "2020-08-14T05:43:59Z")

</div>

Experiencing the same problem while trying to update the deck using special fields addon.  
 ![Capture](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/b/bf38395440c1f4685e8aa97cb3cf379f1c9e1a42.jpeg)

---

<div class="post-metadata">

**Author:** ![mjggoldman](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@mjggoldman](https://forums.ankiweb.net/u/mjggoldman)\
**Post date:** [August 14, 2020, 9:38am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/8 "2020-08-14T09:38:59Z")

</div>

let me try

---

<div class="post-metadata">

**Author:** ![Iris3](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@Iris3](https://forums.ankiweb.net/u/Iris3)\
**Post date:** [August 14, 2020, 1:43pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/9 "2020-08-14T13:43:55Z")

</div>

Hi,  
My anki collection has lots of cards already, but I wanted to add another deck.  
However, when I try to add this deck, I get the following error:

Import failed. Debugging info:  
Traceback (most recent call last):  
File “aqt\importing.py”, line 404, in on\_done  
File “concurrent\futures\_base.py”, line 432, in result  
File “concurrent\futures\_base.py”, line 388, in \_\_get\_result  
File “concurrent\futures\thread.py”, line 57, in run  
File “lib\site-packages\anki\importing\apkg.py”, line 44, in run  
File “lib\site-packages\anki\importing\anki2.py”, line 41, in run  
File “lib\site-packages\anki\importing\anki2.py”, line 64, in _import  
File "C:\Users\Savage Unicorn\AppData\Roaming\Anki2\addons21\1102281552\_init_.py", line 72, in newImportNotes  
shouldAdd = self.\_uniquifyNote(note)  
File “lib\site-packages\anki\importing\anki2.py”, line 189, in _uniquifyNote  
File "C:\Users\Savage Unicorn\AppData\Roaming\Anki2\addons21\1102281552\_init_.py", line 255, in \_mid  
self.dst.models.update(model)  
File “lib\site-packages\anki\models.py”, line 231, in update  
File “lib\site-packages\anki\rsbackend\_gen.py”, line 414, in add\_or\_update\_notetype  
File “lib\site-packages\anki\rsbackend.py”, line 265, in \_run\_command  
anki.rsbackend.InvalidInput: InvalidInput { info: “attempt to save stale notetype” }

If I add the same deck to an empty new anki profile, there are no problems. So I am assuming something is conflicting with the currenty profile / cards I have.  
Can you help me figure out what may be wrong?  
Thank you.

---

<div class="post-metadata">

**Author:** ![mmdj2](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/mmdj2/32/124_2.png) [@mmdj2](https://forums.ankiweb.net/u/mmdj2)\
**Post date:** [August 14, 2020, 2:28pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/10 "2020-08-14T14:28:52Z")

</div>

try temporarily disabling all add-ons and then add the deck you want.

to temporarily disable all add-ons you can hold down shift key while starting the app.  
if you were able to add the deck, then an add-on (special fields probably) is causing this error.

other people seem to be having the same problem:

> [@Unable to update to V7 with errors. Please Help](https://forums.ankiweb.net/t/unable-to-update-to-v7-with-errors-please-help/1857):
>
> Import failed. Debugging info: Traceback (most recent call last): File “aqt/importing.py”, line 403, in on\_done File “concurrent/futures/\_base.py”, line 432, in result File “concurrent/futures/\_base.py”, line 388, in \_\_get\_result File “concurrent/futures/thread.py”, line 57, in run File “anki/importing/apkg.py”, line 44, in run File “anki/importing/anki2.py”, line 41, in run File “anki/importing/anki2.py”, line 64, in \_import File “/Users/matthewgoldman/Library/Application Support/Anki2…

---

<div class="post-metadata">

**Author:** ![Iris3](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@Iris3](https://forums.ankiweb.net/u/Iris3)\
**Post date:** [August 14, 2020, 2:39pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/11 "2020-08-14T14:39:38Z")

</div>

Worked. Thank you!

---

<div class="post-metadata">

**Author:** ![mmdj2](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/mmdj2/32/124_2.png) [@mmdj2](https://forums.ankiweb.net/u/mmdj2)\
**Post date:** [August 14, 2020, 2:41pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/12 "2020-08-14T14:41:33Z")

</div>

it didn’t 😑  
it just disabled all add-ons (temporarily).  
i think you should disable special fields as I think that’s causing this error

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [August 15, 2020, 9:23pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/13 "2020-08-15T21:23:07Z")

</div>

It looks like this occurs in .28 and .29 and happens when you have a more recent version of the note type and try to import and older version of the same note type. Do you have any recommendations on what needs to be updated on the add-on? I have not heard back from John Pincock yet, but I’m getting a few emails a day about this error causing panic for many med students. If not, no worries!

Do you have any plans to incorporate Arthur’s PR anytime soon for this? We plan to be seriously delving into the updating and collaboration side of things in the near future as @andrewsanchez previously messaged you about.

---

<div class="post-metadata">

**Author:** ![andrewsanchez](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/andrewsanchez/32/10294_2.png) [@andrewsanchez](https://forums.ankiweb.net/u/andrewsanchez)\
**Post date:** [August 15, 2020, 10:31pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/14 "2020-08-15T22:31:01Z")

</div>

> [@dae](#):
>
> Assuming it only happens when the add-on is active, then it does look like it needs to be updated - it appears to be saving an old version of a note type that something else already modified.
> 
> Edit: note that this issue likely existed in .28 and .29 as well - I don’t think any recent changes would have suddenly broken this.

> [@NickFlint](#):
>
> It looks like this occurs in .28 and .29 and happens when you have a more recent version of the note type and try to import and older version of the same note type.

So I am quite a newb when it comes to the data model and haven’t dug into the internals with note types, importing, etc., but it looks like this might be a simple fix:

The Special Fields add-on overrides the `_mid` method of the `Anki2Importer` object like so (docstrings removed):

```python
def _mid(self, srcMid):
    if srcMid in self._modelMap:
        return self._modelMap[srcMid]
    mid = srcMid
    srcModel = self.src.models.get(srcMid)
    srcScm = self.src.models.scmhash(srcModel)
    updateNoteType = getUserOptionSpecial("update note styling")
    while True:
        if not self.dst.models.have(mid):
            model = srcModel.copy()
            model["id"] = mid
            model["usn"] = self.col.usn()
            self.dst.models.update(model)
            break
        dstModel = self.dst.models.get(mid)
        dstScm = self.dst.models.scmhash(dstModel)
        if srcScm == dstScm:
            if updateNoteType or (updateNoteType is None and srcModel["mod"] > dstModel["mod"]):
                model = srcModel.copy()
                model["id"] = mid
                model["usn"] = self.col.usn()
                self.dst.models.update(model)
            break
        mid += 1
    self._modelMap[srcMid] = mid
    return mid

```

If I understand correctly, the need is for users to override Anki’s guard against updating a note from another note that has an older time stamp. The bug is a result of the add-on passing models into `Anki2Importer.dst.models.update` which have an older modification time than the note which is to be updated. Is it true that, while this behavior was no allowed previously, it wasn’t strictly enforced anywhere, hence the recent surge of error reports? A quick and dirty patch for the Special Fields add-on could be:

```diff
modified Specialfields21/ __init__.py
@@ -250,6 +250,7 @@ def _mid(self, srcMid):
             # copy styling changes over if newer
             if updateNoteType or (updateNoteType is None and srcModel["mod"] > dstModel["mod"]):
                 model = srcModel.copy()
+ model["mod"] = max(srcModel["mod"], dstModel["mod"])
                 model["id"] = mid
                 model["usn"] = self.col.usn()
                 self.dst.models.update(model)

```

I saw quick and dirty because this clearly contradicts the logic in that parenthetical part of the this branch, so hopefully we can summon @ArthurMilchior to see what he thinks.

**Questions** :  
Do we actually want to let people do this? Is this the right way to allow it? Is there a better way?

Please excuse my ignorance of both the special fields add-on and the relevant Anki internals. I just wanted to report my findings ASAP before other people burn time on this

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [August 16, 2020, 8:14pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/15 "2020-08-16T20:14:38Z")

</div>

@dae it appears this is a fix and the add-on has been updated. I’d still be curious when you’re thinking about looking more into Arthur’s PR though if you have a minute

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [August 17, 2020, 3:30am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/16 "2020-08-17T03:30:32Z")

</div>

@andrewsanchez since the code is checking to make sure the schemas match first, that looks like it’ll do the job - the mtime check is to ensure a stale note type with different fields is not accidentally saved, breaking notes.

@NickFlint once remaining issues have been ironed out of the current stable release, scheduling is likely to be the next thing on the list. Import/export work will likely come after that.

---

<div class="post-metadata">

**Author:** ![ArthurMilchior](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/arthurmilchior/32/4684_2.png) [@ArthurMilchior](https://forums.ankiweb.net/u/ArthurMilchior)\
**Post date:** [August 17, 2020, 8:24am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/17 "2020-08-17T08:24:37Z")

</div>

@andrewsanchez I don’t really get what you want me to answer. Seems you got it right. Congratulation !

The AnKing contacted me. And I was less useful. I understood that it was a problem with trying to update with an older model. Your solution makes a lot of sens.

At best, I would simply state that i’d have done:

```auto
  if srcModel["mod"] < dstModel["mod"]:
    model["mod"] = dstModel["mod"] + 1

```

so that it is absolutely sure that the srcModel is considered the most recent one. During sync, it would ensure that the update occurs in the correct sens I hope. I honestly don’t know what occurs if “mod” is not changed and the schema is changed; that is not supposed to happen. But it may well create no problem at all.

---

<div class="post-metadata">

**Author:** ![patel](https://avatars.discourse-cdn.com/v4/letter/p/dbc845/32.png) [@patel](https://forums.ankiweb.net/u/patel)\
**Post date:** [October 20, 2020, 4:00pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/18 "2020-10-20T16:00:58Z")

</div>

I’m getting this Same error code but I’m not understanding how to fix it. I have the new anki version as I had to buy a new laptop & an older deck so the error code keeps popping up

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [October 24, 2020, 8:48pm UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/19 "2020-10-24T20:48:13Z")

</div>

did you update your add-on?

---

<div class="post-metadata">

**Author:** ![ceejayb](https://avatars.discourse-cdn.com/v4/letter/c/839c29/32.png) [@ceejayb](https://forums.ankiweb.net/u/ceejayb)\
**Post date:** [January 26, 2021, 3:40am UTC](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203/20 "2021-01-26T03:40:44Z")

</div>

Hello! I ended up getting the same error and also am not sure how to fix it. I have deleted and redownloaded the special fields add on multiple times and still keep getting the import failed debugging info error. Please let me know if there is anything else I can do!

[Next page](https://forums.ankiweb.net/t/special-fields-error-on-2-1-30/2203.md?page=2)
