An unexpected error occurred. Please try again later. When document id is NaN

This happens when I try to delete a document with an id of NaN. Does anybody know how to fix this?