After each manually check for updates or cron run, I get no further information about available updates for core or modules. Instead I am always told that the last check was 1 month ago.

The log message gives me next warning :

Warning: Invalid argument supplied for foreach() in template_preprocess_update_report() (line 44 of /var/www/drupal/core/modules/update/update.report.inc) #0 /var/www/drupal/core/includes/bootstrap.inc(548): _drupal_error_handler_real(2, 'Invalid argumen...', '/var/www/drupal...', 44, Array) #1 /var/www/drupal/core/modules/update/update.report.inc(44): _drupal_error_handler(2, 'Invalid argumen...', '/var/www/drupal...', 44, Array) #2 /var/www/drupal/core/lib/Drupal/Core/Theme/ThemeManager.php(287): template_preprocess_update_report(Array, 'update_report', Array) #3 /var/www/drupal/core/lib/Drupal/Core/Render/Renderer.php(435): Drupal\Core\Theme\ThemeManager->render('update_report', Array) #4 /var/www/drupal/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) #5 /var/www/drupal/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(226): Drupal\Core\Render\Renderer->render(Array, false) #6 /var/www/drupal/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() #7 /var/www/drupal/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(227): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #8 /var/www/drupal/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #9 /var/www/drupal/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #10 /var/www/drupal/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #11 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(144): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent)) #12 /var/www/drupal/vendor/symfony/http-kernel/HttpKernel.php(62): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #13 /var/www/drupal/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /var/www/drupal/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/drupal/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/drupal/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/drupal/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/drupal/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/drupal/core/lib/Drupal/Core/DrupalKernel.php(652): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/drupal/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #22 {main}.

There must be a relation to an earlier issue (see https://www.drupal.org/node/2838336) but I don't see how to solve.

Can anyone help me to get out of this ?

Comments

fras42’s picture

If you have access to database check the key_value table, find update_fetch_task entries (collection)
I found entries for modules that have been uninstalled. I deleted all the entries and my updates got working again. Hope it helps

jjgw’s picture

In the key_value table I have 3 rows where collection = 'update_fetch_task'
One row is concerning Drupal, the 2 others are concerning modules.
Do you believe it's safe to execute
delete * from key_value where collection = 'update_fetch_task'
or is your proposal is only concerning uninstalled modules?

liam morland’s picture

I just ran that query on my site and it fixed the problem with no apparent side-effects.

rar9’s picture

I´ve deleted the Key value from Database, but after some time the same error appears again.

What is the main cause for this?

jjgw’s picture

I don't remember the filename, but there will be a zero byte long file in your Drupal main directory. Delete this file.

rar9’s picture

This error is always comming back. 

Warning: Invalid argument supplied for foreach() in template_preprocess_update_report() (line 43 of core/modules/update/update.report.inc).

Any insight what else can be done so ( delete from key_value where collection='update_fetch_task' ) is not required anymore?

andsigno82’s picture

You just saved my mental sanity, man. worked like a charm.

Version 8.6.10

Gapster’s picture

Thanks fras42 it worked like a charm!

nealb13’s picture

Thanks fras42, this fixed the issue for me.

mmjvb’s picture

replacing line 22 :
$data = is_array($variables['data'])?$variables['data']:[];

This will get rid of the message above, but it still leaves you to find out why there are no updates.

lamp5’s picture

I have had the same problem. I found that update settings here /admin/reports/updates/settings are empty. After resaving form, the problem disappeared.

datawench’s picture

lamp5 had the answer for me, in version 8.6.16.

Jacobcullen’s picture

Hi there! It's possible in Drupal 8 to change the user role programmatically, immediately, without the need to relogin? I writing a subscription module and I am worried that after the role change, the user will still have access to functions that should no longer be available...

mmjvb’s picture

Please create your own topic for unrelated support requests.

batigolix’s picture

This error can be caused by ignoring update.settings from the configuration export (using for example the config_ignore module). If it is ignored it will not be available in other environments such as test and staging and it will cause errors like the one mentioned in this post.

rar9’s picture

If I use delete from key_value where collection='update_fetch_task' after some time i will again get this error.

How to get this fully fixed?

Burlyn84’s picture

I have been running into the same thing, but doing the SQL query and deleting the tables didn't do anything for me.