1062 Duplicate Entry error uploading media


Can anyone explain what is happening when I see the following error in the log:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

I’m encountering this when I try to upload some audio files to an item. I’m using the Archive Repertory module to maintain the file name of the media object when I upload it to my Amazon S3 bucket, which is then read by Omeka. Despite clearing the target folder of the particular file it’s pointing to, it just won’t allow me to upload this file.

The rest of my batch of mp3s uploaded fine (some of which were larger in size, some smaller), so there’s no issue with the process itself. The process might have failed at some point, corrupting the database, perhaps? I’m using Omeka 3.2.3.


The error means something is trying to insert a duplicate value in the database in a column where all values need to be unique. The full error might contain more information about what the duplicate value is specifically and point to a possible solution.

I can’t really speak to Archive Repertory and whether it may be involved, but it’s possible. The normal Omeka S behavior is to have the filenames stored in the database be randomized… since Archive Repertory keeps original names instead, it’s possible it could in some situations pick a filename that’s already in the database and lead to this error. That’s just a guess, though.

Hi, thanks for your input. Yes, when I change the file name to something else then the error goes away. Digging some more into this, I’m seeing that I have another file with the same file name in that directory – but with a different extension (.mp3 and .jpg). What seems to be the problem is that some part of Omeka isn’t reading the extension in this process, and so throws up the error. I’m no sure if this is something that could be fixed, as sometimes having media files with the same file name but a different extension is necessary.

This topic was automatically closed 360 days after the last reply. New replies are no longer allowed.