anki icon indicating copy to clipboard operation
anki copied to clipboard

Panic when merging notetypes in import

Open dae opened this issue 3 months ago • 1 comments

thread '' panicked at rslib/src/notetype/merge.rs:42:33: index out of bounds: the len is 22 but the index is 22

Appears to be triggered when the other notetype has more fields than our current one.

Originally reported on https://forums.ankiweb.net/t/im-unable-to-import-any-decks/66497

@RumovZ please don't feel any pressure to reply, but just in case this stuff is still in your head, do you happen to have an opinion on how we should handle that case?

dae avatar Sep 17 '25 12:09 dae

merge.rs:42 is .find_map(|(i, f)| f.is_match(like).then_some(i)) for me, where no indexing occurs. I can only see the calls to swap() or insert() potentially causing this, and only if the same existing field has multiple matches among the incoming field. Did you reproduce the error only with the user's collection, or do you have an MRE I can take a look at?

RumovZ avatar Sep 21 '25 16:09 RumovZ