Closed (duplicate)
Project:
Devel
Version:
7.x-1.0
Component:
devel
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Sep 2010 at 16:12 UTC
Updated:
29 Nov 2014 at 07:12 UTC
Jump to comment: Most recent
The web-based user creation from admin/config/development/generate/user is working fine.
However, if I do
drush genu 50
I get a fatal:
WD php: PDOException: SQLSTATE[23000]: Integrity constraint [error]
violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO
{file_managed} (uid, filemime, filesize, timestamp) VALUES
(:db_insert_placeholder_0, :db_insert_placeholder_1,
:db_insert_placeholder_2, :db_insert_placeholder_3); Array
(
[:db_insert_placeholder_0] => 84
[:db_insert_placeholder_1] => image/png
[:db_insert_placeholder_2] => 0
[:db_insert_placeholder_3] => 1285603796
)
in drupal_write_record() (line 6316 of
/home/rfay/workspace/d7git/includes/common.inc).
WD php: Warning: Cannot modify header information - headers already [warning]
sent by (output started at
/usr/local/lib/drush/includes/drush.inc:871) in drupal_send_headers()
(line 1048 of /home/rfay/workspace/d7git/includes/bootstrap.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (uid, filemime, filesize, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array
(
[:db_insert_placeholder_0] => 84
[:db_insert_placeholder_1] => image/png
[:db_insert_placeholder_2] => 0
[:db_insert_placeholder_3] => 1285603796
)
in drupal_write_record() (line 6316 of /home/rfay/workspace/d7git/includes/common.inc).
Drush command could not be completed. [error]
Comments
Comment #1
moshe weitzman commentedSorry, I can't reproduce it. I am getting fine user pictures in my generated users (using drush).
Comment #2
rfayThat's weird. I've tried a bunch of things (like getting drush head). But haven't actually debugged it. I think I even used a clean db. Oh well. Not terribly critical when the web interface works.
Comment #3
okokokok commentedI'm working on a custom image import script and I was getting similar errors:
This was finally fixed when I did not unset file->fid, which I had done in order to try to fix another error which was actually due false expectations of imagemagick's behavior.
Anyway, my comment might be slightly off-topic, but it might just help someone else in the future and this was the only relevant bug report that showed up on d.o.
Comment #4
eclipsegc commentedSeen the same behavior in node generation through the UI when a custom file path is on the field
Comment #5
moshe weitzman commentedStill can't reproduce the error on users. I have user pictures enabled and they are generating properly.
Comment #6
peter törnstrand commentedSame issue here. It only occurs when I have specified a custom "File directory" in my "File field". I tried changing the permissions on "files"-directory to 777, error still occurs.
Comment #7
ldweeks commentedI think that this problem may have something to do with the features module. Here is what I did:
Comment #8
rfayMaybe this is fixable given the good description in #7.
Comment #9
anitap0322 commentedI am receiving the same error. Not sure looking at the above posts if I know exactly the solution.
Here is the errors I see:
Notice: Undefined property: stdClass::$uri in file_save() (line 575 of /home/theclub/public_html/990clubv1/includes/file.inc).
Warning: Cannot modify header information - headers already sent by (output started at /home/theclub/public_html/990clubv1/includes/common.inc:2561) in drupal_send_headers() (line 1040 of /home/theclub/public_html/990clubv1/includes/bootstrap.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed} (filesize, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 1318935723 ) in drupal_write_record() (line 6776 of /home/theclub/public_html/990clubv1/includes/common.inc).
Comment #10
gregglesI believe this is caused by permission issues on the directories.
Be sure whatever user is running the script has the right permissions on the files directory and all subdirectories. If you are running something as drush then it runs as the command line user so that user needs to have read/write on the files directory (possibly via unix groups management).
Comment #11
danielnolde commentedThis behaviour is almost certainly caused by a little bug / omission in devel.module's filefield content generation plugin, which currently doesn't handle directory preparation/creation correctly.
Details and SOLUTION (with patch) see: http://drupal.org/node/1349288
Comment #12
gregglesOk then #1349288: devel generate has to create paths for filefields
Comment #13
kenorb commentedSee as well: #1163740: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed}
Comment #14
aslamise commentedHad same issue when uploading image after removing file from server.
Solved by going to
admin/content/mediaand removing old media content from there.