Im at a bit of a loss here, this error started happening when saving a new node, or updating an existing node.

It says The website encountered an unexpected error. Please try again later..

The error on the screen is...

Notice: Undefined index: fid in file_field_update() (line 276 of C:\wamp\www\thelhp\modules\file\file.field.inc).

Notice: Undefined index: fid in file_field_update() (line 302 of C:\wamp\www\thelhp\modules\file\file.field.inc).

Notice: Undefined property: stdClass::$fid in file_usage_add() (line 689 of C:\wamp\www\thelhp\includes\file.inc).

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Le champ 'fid' ne peut être vide (null): INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 196 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 696 of C:\wamp\www\thelhp.co.uk\includes\file.inc).

I am now not able to create nodes, or update existing ones.

HOWEVER, after further testing, I have found that if I upload an image to the optional image field, nodes save and update just fine. When no image is uploaded, the errors show up. help! :-(

1 Answer 1


I had custom code in my module...

function custom_node_presave($node) {

  if(isset($node->field_gallery_images)) {


Commenting it out stopped the error

Your Answer

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

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