As a test, I created two decks:
- Deck A has its own deck ID, is own note type with its own ID. Let’s say fields A and B. I create one note with some values.
- Deck B is identical but has its down deck ID and note type ID. But same fields and test note with same value as test note for deck A.
I import deck A. I import deck B. I get:
Notes found in file: 1
Notes skipped, as they’re already in your collection: 1
[Identical] moja (number), one
Yes, the values are identical, but the note IDs are different, so why is this note skipped?
Looking at deck A:
1|O);*8+=E!d|4231129472|1599622037|-1| |moja (number)one|moja (number)|0|0|
And deck B:
1|O);*8+=E!d|3135169473|1599622037|-1| |moja (number)one|moja (number)|0|0|
The mid is different. So why does Anki think they are the same?
I should add that deck B failed to import, so this is clearly causing problems.
It seems there can’t be two independent decks with the same field names and values. This might actually happen in the real world since people often use generic field names like “Front” and “Back”.
In the import dialog there are three options. The default one is to skip notes with an already existing first field. But you can also choose to import them anyway or to update the existing notes.
Based on what abdo said in a different thread, it seems these options only show up when importing text files.
I’m importing .apkg files.
I uploaded the test case in case someone wants to looks at the
.apkg files or the code used to generate them.
git clone https://github.com/tbm/anki-test-same-note-different-deck
test1.apkg: you get
TEST1 Swahili deck.
test2.apkg: you should get
TEST2 Swahili deck but it fails to import.
Both decks define a note type with exactly thee same field, but the note IDs are different (as are the deck IDs), so really importing one deck shouldn’t affect the importing of the other deck - but it does.
I think this is because the notes have the same GUID.
This may be an issue with the way genanki generates GUIDs; it uses the note fields to generate them, but since both notes have the same content, they will get the same GUID.
You can provide an explicit guid argument to genanki.Note or override the guid property.
@abdo sorry for the late response!
Right, the GUID is the same. But as a unique identifier, shouldn’t Anki always look at GUID AND deck id?
There’s no guarantee that different decks don’t have the same GUID.
Well, as GUIDS are supposed to be unique identifiers (each different note is supposed to have a different GUID), I think Anki doesn’t have to check anything other than them when importing. There is a probability of clash in GUIDS generated by Anki but it’s negligable.
(That’s my limited understanding of the situation, maybe @dae can clarify it further)
I think the original intention was to combine notetype ID + guid to get a standard UUID size, but I don’t think the current code is doing that. I’d be surprised if conflicts were common in practice however, outside of usage of third-party tools that are not generating them randomly.
Thanks for the clarification @abdo and @dae. I’ll open a ticket on genanki and see what they say.
Hi. I have the same problem. I’m importing different apkg decks that probably contain notes with the same IDs. I’d still like to import the decks as is without any skips.
My usecase: study three decks simultaneously 2.0HSK1-3 deck, new 3.0HSK1 deck and 2.0HSK4 deck. Currently I can’t even import 3.0HSK1 because almost all notes there are originally taken form 2.0HSK1-3 deck.
You can import them into a separate profile, then export them as text to disassociate them with the originals.