Hi. (sorry by my poor english)
I have a content type with a imagefield 6.x-3.0 with cck 6.x-2.4 in drupal 6.12
When i try to upload a image file appear this error:
"An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again." and the form dissapear.

Thanks for your help

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

This problem does not exist on a fresh install of FileField. You'll need to provide a list of steps to reproduce this problem starting with a fresh install so that I can reproduce. You might also try disabling other modules until uploading works properly.

quicksketch’s picture

Status: Active » Postponed (maintainer needs more info)
desunit’s picture

It's not a problem with ImageField, see this:
http://drupal.org/node/331941

All that you need to do is create hook_form_alter and set there for a form:

$form['#cache'] = TRUE;
manuelBS’s picture

i added the $form['#cache] = TRUE in hook_form_alter but the error is still the same. I have now disabled cacherouter an so it works....But I would like to have cachrouter enabled...is there another problem eventually?

Anonymous’s picture

For me, the error mostly occurs when I open multiple browser windows with a node/edit page (different nodes). The image upload ajax form is then often "lost" on the server. Any ideas? The cache hook solution above also did not work for me.

Tom Verhaeghe’s picture

Title: An unrecoverable error occurred. Form missing from server cache » An unrecoverable error occurred
Project: Drupal core » ImageField
Version: 6.x-dev » 6.x-3.0
Component: cache system » User interface
Priority: Normal » Critical
Status: Needs review » Postponed (maintainer needs more info)

I just had the exact same error. This error occured after installing the Node Clone module. Fixed this error after adding these lines under imagefield_form_content_overview_form_alter in imagefield.module. This fix worked instantly. Let me know if it fixed yours!

function hook_form_alter(&$form, $form_state)
{
  $form['#cache'] = TRUE;
}
TC44’s picture

I'm getting the same error now when trying to upload an image. It seemed to start happening after a certain number of images were uploaded. That was really the only change. There were no modules installed between it working, and the error message starting. In my case it happens everytime, once you select an image and hit "upload"

#6 did not work for me.

TC44’s picture

asb’s picture

Same issue here.

I'd like to try the hack suggested in #3, but can't locate imagefield_form_content_overview_form_alter in imagefield.module.

related (in proper syntax): #539476: "Unrecoverable error" is giving *me* a headache, too! and #500220: Wrong conditions for cache flush in memcache.inc? (in my case, the error appeared directly after enabling memcache-module).

Any suggestings?

Thanks & greetings, -asb

beetbe.com’s picture

Having the same problem and still has no solution. Any ideas, link to resolve it ?

beetbe.com’s picture

@Heart Driven
I can't find "imagefield_form_content_overview_form_alter in imagefield.module" as you say
Is there anyone here fixed this ?

asb’s picture

> Is there anyone here fixed this ?

I can't fix this issue, but I know what it caused it in my case: enabling the memcache.module directly triggers the "unrecoverable error" (cf. #500220: Wrong conditions for cache flush in memcache.inc?). However, this issue seems to be far more complex and needs to be solved by it's root since lots of this fancy CCK stuff went into the D7 code...

Greetings, -asb

ckng’s picture

Status: Postponed (maintainer needs more info) » Active

Having the same problem when memcached is enabled (using memcache.inc). See #500220: Wrong conditions for cache flush in memcache.inc?

For me, it is not an issue of upload file size, post max size or suhosin, as they are high enough for my need (on VPS). The $form['#cache'] = TRUE; into form_alter also does not solve the problem.

ronnbot’s picture

We are seeing the same error too in a similar installation: cck, imagefield, multiple memcache severs (one for each web server accessed via cache router)

The problem for us is that when the form is sent back, it may end up in a different webserver that did not originally generate the form, hence not having any of the additional form data cached in its memory (memcache).

We get around this (for now) by accessing one of the webservers directly to do the admin stuff.

We are trying out each of the following as a more permanent fix:

  • change load balancer settings so that a user sticks to one webserver
  • patch memcache to do replication: http://repcached.lab.klab.org/
  • centralize a memcache bin for cache_form, or simply just have one dedicated memcache server
  • keep form cache data from hitting memcache, and just store it in DB (cache_form table) as it did originally w/o memcache

UPDATE:
We did the simplest change for now - changed settings.php so that cache_form bin points to one of the webservers, and it works.

den2penguin’s picture

Hi!! I have the same problem. But i already fixed it.
The problem occurred to me when i hide/disabled this code in my template.php file
$vars['whole_form'] = drupal_render($vars['form']);

Then, after in enable it again in my template.php and hide it in my *.tpl.php file.
The error is gone.

btw, Thanks for all the instructions/way how to solve this kind of problem. This might be useful in the future.

flavor’s picture

I solved this problem by going into my Performance settings and disabling all the cache settings. I set the min lifetime to none and it fixed it.

hedac’s picture

I have the same error with filefield for mp3 files... not an issue of imagefield.
I think I started to have this error since I enabled APC RFC1867 as described in the status report: admin/reports/status

jthaxton’s picture

I have this same problem and solved it, temporarily, updating any content types that had BOTH an imagefield and embedded media field so the image field loaded AFTER the embedded media field. Weird, but it solves my problem. Not a true solution but clearly these two modules are having at it.

justinlevi’s picture

I just got this bug as well.

Modifying imagefield.module, by adding the imagefield_form_alter function, worked for me the first time I tried to re-upload a large video. However, I'm still seeing this issue on every large image upload now.

Justin

function imagefield_form_alter(&$form, $form_state)
{
  $form['#cache'] = TRUE;
}

*UPDATE - I have continued to run into this issue on different Drupal installs and only seem to be able to fix the situation if I disable all cache settings.

marcus178’s picture

I'm having the same result too. Although I'm sure it worked yesterday and can't work out why.

dicreat’s picture

subscribe

Rasta00’s picture

So I don't know if this will help, but I found a fix that worked for me. Hopefully it will be of some assistance.

I had been playing around with the cache table right before this problem appeared. I was having the exact same problem as everyone else. I was getting the Unrecoverable Error message, and the 'Upload' button would disappear. I tried a bunch of the fixes but nothing worked.

I know I had backups set to dump the database everyday and when I went to look at the archived dumps, I noticed they were all too small. On further inspection, I saw the dumps weren't happening because some of the tables were messed up and needed to be repaired.

The first error pointed to the cache table. I took a look at the table via PHPMyAdmin and got the message - 'the table is corrupted -repair it' (or something to that effect). So I entered into the SQL box 'repair table cache;'.

After doing that the table was repaired but the problem persisted.

After some further inspection, I noticed that I had another error emerging from the failed backups regarding the cache_form table.

The error was:
Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `cache_form`': Incorrect key file for table './database_name/cache_form.MYI'; try to repair it (126)

Again, I took a look at the cache_form table in PHPMyAdmin, and there was also a warning there again stating - 'the table's messed up - repair it'. Again, entered 'repair table cache_form;'

The table was repaired, and when I went back to my site I was able to upload the image successfully.

I've been looking for a fix for this problem for almost a week now, and have been following these threads (and others) and hope this helps. My advice would be to check all of your 'cache' and 'cache_' tables to see if any of them need repairing. PHPMyAdmin was a helpful tool in easily checking this.

Good luck!

wickedskaman’s picture

If you are working with preprocess variables and templates comment #15 by den2penguin is very helpful.

You might be forgetting to load the rest of the form data which has some of the settings needed for the imagefield to work.

After assigning variables to the appropriate form elements print the rest of the form inside a div that you hide like this:

In your preprocess function:

  $vars['element1'] = drupal_render($vars['form']['title']);
  $vars['element2'] = drupal_render($vars['form']['body_field']);

In your template:

<h1>Whatever you want goes here! WHUT!</h1>
<?php print $element1; ?>
<?php print $element2; ?>
<div style="display:none;">
<?php print drupal_render($form); //this renders all remaining elements, visible or simply "invisible" settings, not specifically assigned to a template variable ?>
</div>

Yes, I am aware that inline CSS is nasty... but it's there for the implicit example.
If you are a stickler like me you can unset visible form elements one by one in the preprocess function like so:

//...pretend I just finished assigning all the form elements I am going to use to variables... now I'll remove the outcasts
  unset($vars['form']['teaser_field']);
  unset($vars['form']['menu']);
//etc etc.

This did the trick for me. There's a very good step-by-step tutorial here: http://blip.tv/file/1139210 (video!)
There's also some good reading here: http://drupal.org/node/368776

Bon apetit.

Anonymous’s picture

Solution found for cacherouter users:

If you use an opcode cache like APC cache w/ cacherouter, then think about the 'cache_form' table. APC cache doesnt cache the form sessions correctly. You need to remove that table from apc caching, similar to this (in settings.php):

$conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'apc',
    'shared' => TRUE,
    'static' => FALSE,
    'fast_cache' => TRUE,
  ),
  'cache_form' => array(
    'engine' => 'db',
  ),
);

So put 'cache_form' back into the regular db.

madwalo’s picture

i got the same error, i have memcached on my server and the error was shown when memcached went down or full, i've restarted memcached and it worked again

jaydubb181’s picture

#16 solved the problem for me.

Kane’s picture

Same problem here. Don't know where to put

function imagefield_form_alter(&$form, $form_state)
{
  $form['#cache'] = TRUE;
}

because there's no imagefield_form_content_overview_form_alter.

Maybe disabling cache can help with it, but for me that's just not an option.

Steven Jones’s picture

If you're encountering the error, and you have memcached running, you might want to look at #719588: Documentation of memcached installation

mkalbere’s picture

#24 solved it for me ...

rwd’s picture

#24 solved this issue for me; thanks morningtime.

RikiB’s picture

#24 worked for me

asb’s picture

Status: Active » Reviewed & tested by the community
quicksketch’s picture

Category: bug » support
Priority: Critical » Normal
Status: Reviewed & tested by the community » Fixed

Hmm, so mark this as fixed? What can ImageField do about CacheRouter breaking the cache_form table/bin?

quicksketch’s picture

Title: An unrecoverable error occurred » An unrecoverable error occurred (CacheRouter configuration problem)

Updating title for future searchability.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Exploratus’s picture

I tried #24 using memcache but it didnt work. Still get the error from #1 every time more than one user tries to add a node at once. If two people add a node, or if one person tries to add two nodes at once, then imagefield gives the error. One needs to save, and reupload...

$conf['cacherouter'] = array(
'default' => array(
'engine' => 'memcache', // apc, memcache, db, file, eacc or xcache
'servers' => array('localhost:11211'),
'shared' => TRUE,
'prefix' => '',
'path' => 'sites/default/files/filecache',
'static' => FALSE,
),
'cache_form' => array(
'engine' => 'db',
),
);

winawer’s picture

I have the same problem. for me it solved by making writable "file" folder.

winawer’s picture

Title: An unrecoverable error occurred (CacheRouter configuration problem) » another possible solution

just see your "file" folder in address: sites\default\files. if this folder or subfolders be "read only" can make this problem.
I hope this help.

asb’s picture

Title: another possible solution » An unrecoverable error occurred (CacheRouter configuration problem)

Fixing title (as of #34)

opdavies’s picture

#16 worked for me too!

opdavies’s picture

This worked for me too!

Exploratus’s picture

#37. But I am not writing to folder.. I am using memcahce and db... Why would I need to make the files folder 777. I have it at 775.

AlanAtLarge’s picture

#16 setting min lifetime to worked, but isn't that just a workaround?

mkalbere’s picture

yes : #16 is very bad. Of course you wont get any cahe error if you disable your cache ... seems obvious. But even for sites web with low traffic, cache should be used at least for anonymous.
No cache= bad performance, server overload, hangry customer ..

#24 did work perfectly for me and allow you to serve cached pages.

Fleshgrinder’s picture

Same problem here, comment #24 solved the problem for me. Here the related part of my settings.php:

/**
 * Cacherouter settings
 */
$conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
  'default' => array(
    'engine' => 'apc',
    'servers' => array(),
    'shared' => TRUE,
    'prefix' => '',
    'path' => 'sites/default/files/filecache',
    'static' => FALSE,
    'fast_cache' => TRUE,
  ),
  // Never cache forms!
  'cache_form' => array(
    'engine' => 'db',
  ),
);
blueprint’s picture

Hejo,

I had tried the various solutions, to no avail. However, it seemed clear that improper form handling might be a problem. I had had functioning uploads UNTIL I installed / enabled the popup module. After disabling it, everything was fine. Should this be reported to the popup issue queue?

mattwmc’s picture

I have this problem as well.

I need to reload the page and then it works fine.

domidc’s picture

The upload problem caused by a form cache error due to memcached ceased when I gave the cache_form table its own bin cache bin as described in #14
Maybe this should be taken into the documentation when installing memcached?

sp_key’s picture

For me it happened when I installed taxonomy super.
btw, I don't have cacherouter installed, how is this a cacherouter configuration issue?

sp_key’s picture

I have the same problem.
I can confirm with certainty the following:
All cache optimizations under /admin/settings/performance are ALREADY disabled (this is my staging environment) and the problem is there every time I try to upload an image.

I can also confirm I haven't installed CacheRouter OR memcache however, if I run Cron I get the below warning:

Performance logging APC disabled.
Performance logging on live web sites works best if APC is enabled.

I don't know if this is any related - can you please advice?

Also, I want to try #24 but I can't follow the instructions of how to achieve this (in particular removing the table and putting it back?). Can someone please be a bit more detailed?

Many thanks in advance

sp_key’s picture

Update: After many tests, I've found out that in my case it might be the 'drupal for facebook' module.
The problem is this: In my site users log in to create events. If they create a new drupal account then uploading an image works. If they connect using facebook connect they get the aforementioned issue

bleen’s picture

subscribing ... I am having the same problem, but only intermittently. I use the memcache module (not cache_router) and I have been playing with variaous combinations of settings for days ... no dice yet

mr.j’s picture

Title: An unrecoverable error occurred (CacheRouter configuration problem) » An unrecoverable error occurred. Form missing from server cache
Status: Closed (fixed) » Active

Same problem here. Sadly the error is intermittent and a reload of the edit page and re-upload of the image works. I do not use cacherouter or memcached at all, and it can't be a php upload limit as I read on another thread, as it does work after reloading.

Setting the site caching mode to disabled in performance settings does not fix the problem.

So it is extremely difficult to debug.

bleen’s picture

memcache users ... this solved my problem:
#959200: Add ability to exclude bins (tables) from memcache

manuelBS’s picture

For cacherouter Users, you have to set

'cache_form' => array(
'engine' => 'db',
),

in your cachrouter array in settings.php

This worked for me.

marsh’s picture

Had the same problem. Disabling the Popup module did the trick.

superflyman’s picture

I am having the same problem as well. Using Imagefield, Filefield and Insert modules. Typically, after 1 or more uploads somewhere along the line we get this error. Also, if you save a node and them come back and try and add images, it breaks immediately.

marios88’s picture

#24 fixed it

bharathi2626’s picture

/etc/init.d/memcached restart

fchandler’s picture

I had this issue with a Drupal 6.20 install running Filefield 6.x-3.10, Imagefield 6.x-3.10 and Imagecache 6.x-2.0-beta12. Got the errors on trying to upload. Could refresh and load the image, but the thumbnails would not show up in the view (6.x-2.12). Turns out there was an "&" in the file names. Took that out and the thumbnails showed up in the view. And did not get the error, if that helps.

mr.j’s picture

I can reproduce this by editing nodes in multiple tabs. Go to a node list somewhere and click the edit links on several of them to open in multiple tabs. Once you have uploaded an image to one and saved it, the upload of images to the others will fail every time until you reload their pages.

enjoylife-2’s picture

morningtime, did you solve the problem? my site recently have the same problem with you.

enjoylife-2’s picture

my site works fine some time. but recently it occurs the same problem as #5 #7.

how to correct it? i didn't install the module memecache and cacherouter. what's the reason that maybe cause this problem?

enjoylife-2’s picture

anybody solved this problem?

bshensky’s picture

Just wanted to share my facepalm moment...

Our Development server runs memcache. Our Production server does not.

Production was misbehaving on ALL AHAH form code associated with file uploads as well as file delete requests. The errors included the one discussed here:

  • An unrecoverable error occurred. Form missing from server cache.
  • An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (@size) that this server supports.

as found at lines 575 and 587 in filefield.module

Culprit?

There's no memcache daemon running on our Production server as there was on the Development server, so I had disabled the memcache module on Production. Seems simple enough.

BUT memcache module requires that you set a reference to an include file ('cache_inc' => './sites/all/modules/memcache/memcache.inc') in the $conf hash in the sites/SITENAME/settings.php file. I had forgotten to remove that entry alongside turning off memcache support module.

Having it in the $conf hash was enough for the AHAH to go apesh!t on me, despite having turned off the memcache support module.

I removed the offender from the $conf hash, and the problem went away.

Soon, my blood pressure will return to normal.

Thomasr976’s picture

Same problem as #63 and in search of a solution. Seems to occur mainly withy blog nodes.

uday4ru’s picture

Thanks , I got this error after moving website to other server. I have added your code and now things works perfect.

jmensonen’s picture

#45 fixed the problem with me. So if you're using cachrouter with apc, definitely try this out. Cheers!

bserem’s picture

In my case the cache_form table needed repairs.
I suggest to everybody to check this first if they are not using memcache/cacherouter.

I also posted this info here: http://drupal.org/node/795004#comment-5118256
in case it helps somebody

webcomm’s picture

Removing the following from my settings.php fixed the problem for me:

$conf = array(
'cache_inc' => 'includes/cache-install.inc',
);

joyofkolkata’s picture

I got the solution from this article:
http://www.kdweb.co.uk/blog/drupal-filefield-module-bug-and-other-modules-using-ahah-form-%E2%80%9C-form-was-missing-server-cache%E2%80%9D

The solution is updating one line in includes/cache.inc from

From

if (isset($user->cache) && $user->cache > $cache->created) {

To

if (isset($user->cache) && $user->cache > $cache->expire) {

DRUPALON’s picture

so many thanks #71
this works fine

atutweb’s picture

#24 is working. Thank you so much.

mikeytown2’s picture

Project: ImageField » Drupal core
Version: 6.x-3.0 » 6.x-dev
Component: User interface » cache system
Category: support » bug
Status: Active » Needs review
FileSize
559 bytes

Patch attached. I haven't looked into the fundamentals of this, but we have this issue popup every now and then so there is something wrong. Patch works for core and for pressflow.

silios’s picture

Version: 6.x-dev » 6.3

Disabling the option "Show memcache statistics at the bottom of each page" at /admin/settings/memcache stopped the error and images are uploaded normally again on my installation (with memcache module). Might try that as well before patching and what not.

mikeytown2’s picture

Version: 6.3 » 6.x-dev

If your using memcache, this patch (#74) will do nothing as cache.inc from core is replaced with the one from memcache.

kaanon’s picture

Thought I'd chime in.

For me, memcache had stopped. I just needed to restart it.

jmonma’s picture

For those using memcache, and/or project mercury, encountering this issue (and are sure it's still running on your server), the following variation of #24 fixed it for me...

change the memcache bin for forms to 'database' in settings.php. For me I had to change from:

$conf['memcache_bins'] = array(
      'cache'    => 'default',
      'cache_form'   => 'form',

To:

$conf['memcache_bins'] = array(
      'cache'    => 'default',
      'cache_form'   => 'database',
Peter Törnstrand’s picture

#74 solved my problem. I'm not using memcache.

abhigupta’s picture

#74 didn't fix my problem. However, I noticed that on my server mysql variable max_allowed_packet was set to 1M and when I increased it to 8M, it fixed the issue. Some of those serialized cache variables are very big.

pasive’s picture

Thanks @ronn abueg The simplest approach with cache_form bin changes in settings file worked for us on bounty.com website.

deggertsen’s picture

#74 worked for me as well. Hopefully this can be in the next release.

chales’s picture

Note for others who may run across this error. Please check your error logs because I also just experienced this error with a new migration. The issue was as posted in #80, mysql had max_allowed_packet set to the default of 1M. Adding max_allowed_packet = 16M to the my.cnf file took care of the error for me.

e0ipso’s picture

Restarting memcached solved the problem for me.

Anonymous’s picture

Title: An unrecoverable error occurred » An unrecoverable error occurred. Form missing from server cache
Project: ImageField » Drupal core
Version: 6.x-3.0 » 6.x-dev
Component: User interface » token system
Priority: Critical » Normal
Status: Postponed (maintainer needs more info) » Needs review

I will repair the table cache_form and this will worked for me.

BrockBoland’s picture

Needs issue summary (badly)

Anonymous’s picture

I think #78 is right when using memcached. Don't store the cache_form table in memcached.

aveldina’s picture

Had this issue this morning, am using memcache. In my case it seems memcache had stopped and had to be restarted. Now wondering why memcache stopped..

Damien Tournoud’s picture

Status: Needs review » Closed (duplicate)

#74 is totally bogus.

The problem is that the minimum cache lifetime feature is broken as it should track the clearing per bins. For Drupal 7, it has been fixed in #1015946: Eliminate $user->cache and {session}.cache in favor of $_SESSION['cache_expiration'][$bin].

For Drupal 6, just disable the minimum cache lifetime feature. It is way more trouble then it worth.

marc.groth’s picture

#25 worked for me.

Didn't check that memcache was running after migrating to a different server... Turns out it wasn't. Restarting it fixed the issue :)

marthinal’s picture

I got the same issue here. Memcache service was stopped, so verify the status of the service.

Thanks!

warmnoise’s picture

For those of you visiting this thread that are using APC opcode cache, it seems that using it for upload progress will generate issues. In this case, an image field generated an HTTP error 0 when trying to upload. You will need to either:

* Disable apc.rfc1867
* Use an alternative uploadprogress such as PECL.

AaronBauman’s picture

Got this problem while running on Acquia (memcache, apc, other goodies) and #78 fixed it.

mattwmc’s picture

Restaring memcached worked for me

kollimited’s picture

It happens sometime that what we want does not happen even when we are on the right way.So, try it once more.I am sure this time it wont show an error. Web development london

eddie_c’s picture

I'm not using memcache or cacherouter but like #69 and #85 the cache_form table was marked as crashed.

I checked this was the case by running this query:

select * from cache_form limit 10;

And got the response:

ERROR 144 (HY000): Table './<database>/cache_form' is marked as crashed and last (automatic?) repair failed

To fix it I then ran:

REPAIR TABLE cache_form;

pkum’s picture

#78 solved my problem. Thanks a lot!

soulfroys’s picture

Issue summary: View changes

#96 is my case too :-)

franekdziupla’s picture

Hello,
I've had the same problem...

In my case i logged in phpmyadmin and seen, that the table cache_form was missing! No idea why. So, I got structure of one from another installation of Drupal and....
Boom! Works fine for me :)

Strange this thing...

rschletty’s picture

The reason I received this error was because I had an accented vowel in the filename: Un día caminaba

Changing the file name to Un dia caminaba fixed it.