FooSoft / anki-connect

Anki plugin to expose a remote API for creating flash cards.
https://foosoft.net/projects/anki-connect/
Other
1.92k stars 218 forks source link

Confusing error message #406

Open Madoshakalaka opened 11 months ago

Madoshakalaka commented 11 months ago

Hi, new user and absolutely love this project. However, this error message is confusing. It says "cannot create note because it is empty"

But in this case, the creation fails because of a mismatch of field names. It took me a while to realize.

My fields are not called "Front" and "Back".

Traceback (most recent call last):
  File "c:\Users\Matt\Desktop\ankigen\main.py", line 22, in <module>
    result = invoke('addNote', note={"deckName": "日本語", "modelName": "Japanese", "fields":{"Front": "what da dog doing", "Back":"bark bark"}})
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^   
  File "c:\Users\Matt\Desktop\ankigen\main.py", line 19, in invoke
    raise Exception(response['error'])
Exception: cannot create note because it is empty
doomdagadiggiedahdah commented 8 months ago

Can you paste the code you're using?