Goal:
I’m trying to create a custom local web-based interface (HTML/CSS/JS) to study my existing Anki cards. The key features are displaying multiple cards at once (e.g., 10 cards in two columns), allowing front/back selection, and using Anki’s scheduling via Again/Hard/Good/Easy buttons.
Approach:
Using the AnkiConnect add-on to allow my local HTML/JS application (opened via file://) to interact with my running Anki Desktop application.
Core Problem:
AnkiConnect’s findCards action consistently returns an empty result array ({“result”: , “error”: null}) for any query I try (e.g., deck:“My Deck” limit:1, deck:* limit:1, limit:1). This happens despite the fact that:
-
Cards definitely exist in the specified decks.
-
The exact same query strings (e.g., deck:“My Deck”) work correctly and find cards when used directly in the Anki Desktop Browser search bar.
Secondary Problem:
When attempting to bypass findCards and fetch note data directly using a known Note ID via the notesInfo action, AnkiConnect returns {“result”: null, “error”: “‘int’ object is not iterable”}. This suggests a deeper issue than just the search function.
Key Finding:
Both the findCards empty result and the notesInfo error persist even when testing on a completely new, clean Anki profile with only one simple card (“Basic” type) in a new deck (“TestDeck”). This strongly indicates the issue is not specific to my main collection’s data or structure.
Troubleshooting Steps Performed:
-
Verified Card Existence: Confirmed cards exist in relevant decks using Anki Browser.
-
Tested Queries in Anki Browser: Confirmed the exact query strings used via API work correctly within Anki’s own Browser search.
-
Direct API Calls: Used direct fetch commands from the browser’s developer console, bypassing my custom app’s code. The issues (findCards returning , notesInfo erroring) were reproduced here.
-
AnkiConnect Config: Verified AnkiConnect’s CORS settings (webCorsOriginList) includes “null” to allow requests from file:// origins. The config was confirmed correct. Basic actions like version and deckNames work correctly via the API.
-
Anki Maintenance: Ran Anki’s “Check Database” tool.
-
Add-on Conflicts: Disabled all other Anki add-ons except AnkiConnect; the issue persisted.
-
Reinstall AnkiConnect: Deleted and reinstalled the AnkiConnect add-on (v6 is reported by the version action).
-
Anki Version Downgrade: Issue occurred on my original latest Anki version. Downgraded to Anki 23.10.1 (tried Qt6 build); the issue persisted on both. Reinstalled the latest Anki version – issue persists.
-
Clean Anki Profile: Created a new Anki user profile, added one card, ensured AnkiConnect was enabled and CORS configured; the issue persisted on this clean profile.
-
System Firewall/Antivirus: Temporarily disabled Windows Defender Firewall (active profile) and any relevant real-time antivirus protection; the issue persisted.
-
Different Browsers: Tested direct fetch calls from multiple browsers (e.g., Chrome, Firefox, Edge); the issue persisted.
-
Port Conflicts: Used netstat to confirm port 8765 is listened on by anki.exe when Anki is running and free otherwise.
-
AnkiConnect Logging: Enabled apiLogPath. The log file successfully recorded incoming requests (findCards, notesInfo) and their corresponding replies ({“result”: , “error”: null} for findCards, {“result”: null, “error”: “‘int’ object is not iterable”} for notesInfo) but showed no internal error messages or stack traces within AnkiConnect itself during the processing of these actions.
System Information:
-
OS: Windows 11 Home
-
Anki Versions Tested: Latest stable (e.g., 24.04.1), 23.10.1 (Qt6).
Question:
Given that findCards returns empty and notesInfo errors even on a clean profile, despite basic actions working and no errors logged by AnkiConnect itself, has anyone encountered a similar issue or have any suggestions for diagnosing this further? It seems like a deeper incompatibility or environmental issue affecting how AnkiConnect interacts with Anki’s core data handling on my specific machine.