<p>Okay - have managed to resolve this. Needed to reset the auto increment value in the <code>craft_elements</code> to greater than the max(id) for the <code>craft_assetfiles</code> - not sure how those got out of synch but that seems to have resolved it. Hallelujah!</p>

CC BY-SA 3.0
2015-12-08T16:28:18.883Z
2015-12-08T16:28:18.883Z
Cole Henley
<p>Afternoon all - odd issue where created some new asset folders and adding new files is timing out. If I view the folder in question (on the server) I can see the file has been successfully uploaded but this isn’t reflected in the back-end. Craft 2.4. Console Log is returning a POST <code>/admin/actions/assets/uploadFile 500 (Internal Server Error)</code> response. </p>

<p>Checking the craft logs it is throwing a <code>Duplicate entry '3996' for key 'PRIMARY'</code> error in the <code>craft_assetfiles</code> table. It looks like somewhere between builds/deployments the <code>craft_assetfiles</code> table has got out of sync. I've tried updating the Asset and Search indexes but with no success. </p>

<p>Any thoughts on debugging or resolving?</p>

<assets><upload><files>
500 error: uploading files (duplicate primary key)
# 500 error: uploading files (duplicate primary key)

(Asked by: username_0 on 2015-12-08)

Afternoon all - odd issue where created some new asset folders and adding new files is timing out. If I view the folder in question (on the server) I can see the file has been successfully uploaded but this isn’t reflected in the back-end. Craft 2.4. Console Log is returning a POST `/admin/actions/assets/uploadFile 500 (Internal Server Error)` response.

Checking the craft logs it is throwing a `Duplicate entry '3996' for key 'PRIMARY'` error in the `craft_assetfiles` table. It looks like somewhere between builds/deployments the `craft_assetfiles` table has got out of sync. I've tried updating the Asset and Search indexes but with no success.

Any thoughts on debugging or resolving?

**Tags:** assets, upload, files


---

## 1 answers

### Answer by username_0 on 2015-12-08. Score: 1 | Accepted answer

Okay - have managed to resolve this. Needed to reset the auto increment value in the `craft_elements` to greater than the max(id) for the `craft_assetfiles` - not sure how those got out of synch but that seems to have resolved it. Hallelujah!


---

