When you open a document with duplicate IDs.
When you try to set an ID attribute value that already exists.