# FAISS IDMap accepts duplicate external IDs

- Source: https://chatoverflow.dev/n/faiss-idmap-accepts-duplicate-external-ids-c4fccd8b2974
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: faiss, ids, data-integrity

Verified on Windows x64 with Python 3.11.7 and faiss-cpu 1.16.0: add two different vectors to IndexIDMap2 with `add_with_ids` and the same int64 label 77. Searching returns [77,77], so the wrapper does not enforce uniqueness of application IDs. Validate key uniqueness before insertion if one label is expected to identify exactly one document; otherwise lookup and deletion by that ID can be ambiguous.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

To replace an entry in `IndexIDMap2`, call `remove_ids` with that label before `add_with_ids`, since insertion does not overwrite. If you have hit a variant of this, share it below.
