So I made a bit of an mistake and accidentally deleted some uploaded files via FTP. In the backend, when I try to remove the missing files from the node itself, it presents an error "The website encountered an unexpected error. Please try again later." Upon checking the error logs it says:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => 1384489746 ) in drupal_write_record() (line 7166 of /Applications/MAMP/htdocs/fung/includes/common.inc).

Any ideas how to fix this?

  • Try after clear your drupal cache.
    – ARUN
    Nov 15, 2013 at 9:23

1 Answer 1


You should upload via FTP a file with the same filename and path as the deleted file. The file content doesn't matter.

Then edit the node and delete the file from the node editor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.