When I try to update Drupal from 8.4.0 to 8.6.1 I got the following error

Module Views
Updating table_display_cache_max_age

Fail: InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (line 729 of /http/xxx/site/core/lib/Drupal/Core/Database/Connection.php).

Comments

igormagic created an issue. See original summary.

cilefen’s picture

Category: Support request » Bug report
Priority: Normal » Major
teddyvermeulin’s picture

I have exactly the same error :
InvalidArgumentException : Placeholders must have a trailing [] if they are to be expanded with an array of values. dans Drupal\Core\Database\Connection->expandArguments() (ligne 729 de /Applications/MAMP/htdocs/ssam2019/core/lib/Drupal/Core/Database/Connection.php).

Any idea ?

cilefen’s picture

Component: update.module » views.module
Related issues: +#2932083: Views Table style plugin breaks dynamic cache

Based on "Updating table_display_cache_max_age" this is going to be related to #2932083.

teddyvermeulin’s picture

Thanks.
I just downgraded to 8.5.6 and after upgrade to 8.6.1 and error disappear.
Best,
Teddy

lendude’s picture

after #2932083: Views Table style plugin breaks dynamic cache landed it got updated in #2949351: Add a helper class to make updating configuration simple to use \Drupal\Core\Config\Entity\ConfigEntityUpdater. Might be that the problem resides somewhere in that class. No idea if that is the case, but might be worth looking at.

lendude’s picture

My first thought was that this might happen when there are no entities to update. But a quick test addition to \Drupal\KernelTests\Core\Config\Entity\ConfigEntityUpdaterTest showed that works fine.

Since that update function does nothing more then trigger save() on each table view, do you have any Views that are strange/special/invalid/broken? Any views that break when you save them manually?

Just thinking out loud here.

Clauce’s picture

Hello,

I have the same problem, update drupal core from 8.4.5 to 8.6.1 and all modules along.
The db update throws the same error and those two tasks are left in queue :

views module

Fix cache max age for table displays.
Include views data table provider in views dependencies.

Any other idea how this can be resolved ?
Thanks

cupcakemuncher’s picture

I can confirm this.
Also updating from 8.5.6 to 8.6.2. "drush updb && drush entup" run without a problem.
"drush cim" on the other hand throws

In ConfigImportCommands.php line 259:

The import failed due to the following reasons:
Unexpected error during import with operation update for views.view.watchdog: Placeholders must have a trailing [] if they are to be expanded with an array of values.

mpp’s picture

Same error occurs after upgrading from 8.4 to 8.6.2.

These are the views for which update returns TRUE:

block_content
content
files
glossary
user_admin_people
watchdog

The latter, watchdog is causing the error, when saving the watchdog view I get the same error:

Referrer: /admin/structure/views/view/watchdog
Message: InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (regel 729 van /core/lib/Drupal/Core/Database/Connection.php).

I can't save the watchdog view, I can create a duplicate "watchdog_clone" and delete the original view. The config is identical with exception of the label & the uuid:

< uuid: 01690db6-c884-4a39-a48a-a977e46aac43
---
> uuid: fe6185af-9f24-445c-9375-e6c2af0b647d
10,11c10,11
< id: watchdog
< label: Watchdog
---
> id: duplicaat_van_watchdog
> label: 'Duplicaat van Watchdog'

When I clone the view back to the original name I can no longer save it...

Removing the Views "No results text" under "No Results Behavior" in the "Watchdog" view fixed it.

hans.p.’s picture

Hi all, is this problem fixed?
I got the same error after updating drupal to 8.6.4.
Referring to errormessage-admin-reports-dblog.png

None of the related issue are clear enough for a fix.
Removing the empty behavior in the watchdogs view doesn't fix the problem for me.
Updating drupal via update.php after the watchdogs fix gives that same error again:

Module Views
Updating table_display_cache_max_age

InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (regel 729 van /core/lib/Drupal/Core/Database/Connection.php)

The update also broke down my default theme to a non-css styled page.

Changing to another theme like Bartik doesn't have any problem, and shows as designed. Referring to page-with-bartik-theme.png
Therefor i tried setting bartik as default & cleared the cache.
Change back to the custom theme and cleared the cache again. But this results back in the non-styled page with only the plain text. Referring to page-with-corrupted-default-custom-theme.png

hans.p.’s picture

Changing to the english default language seems to fix the error.
But left me with the corrupted custom theme.

any suggestions?

illutek’s picture

Same problem here after updating from 8.4.8 to 8.6.7

table_display_cache_max_age bijwerken
Mislukt: InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (regel 729 van /var/www/drupal/D8/toneelkliekske_NED/core/lib/Drupal/Core/Database/Connection.php).
ricardo.faria’s picture

I also have this issue. Using core version 8.6.8. Got this error after upgrade from 8.6.4. Investigating.

jjancel’s picture

Same problem here after updating to 8.6.9

salihcenap’s picture

Bump! Faced the same problem after updating to 8.6.9

cilefen’s picture

Title: InvalidArgumentException when updating the database » InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() when updating the database to 8.6.x
b0gucki3’s picture

Using 8.6.10, Drupal throws an exception when sending more than are arguments to buildRenderable() function.
The following works:

$view = \Drupal\views\Views::getView('news_2');
$variables['news'] = $view->buildRenderable('block_1', array(1));

The following doesn't work. It throws an exception Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments()

$view = \Drupal\views\Views::getView('news_2');
$variables['news'] = $view->buildRenderable('block_1', array(array(1, 2), array(3)));
unarain’s picture

Same problem as @illutek

Update from 8.4.1 to 8.6.10

[error] Placeholders must have a trailing [] if they are to be expanded with an array of values.
[error] Update failed: views_post_update_table_display_cache_max_age
[error] Update aborted by: views_post_update_table_display_cache_max_age
[error] Finished performing updates.

Anyone managed to solve this issue ?

baysaa’s picture

There was a serialization bug issue created for hal and serialization core modules in #3037970: Custom serialized field's data should be normalized even if it's empty. It might be related to the issues people are having in the latest comments. Have a go at the patch in the linked issue.

Luc Dengis’s picture

I have the same issue: when running update.php there are 2 update:
Fix cache max age for table displays.
Include views data table provider in views dependencies.

the update process fails with this error: InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (regel 729 van /data/sites/web/vvw-gent-leiebe/www/test/core/lib/Drupal/Core/Database/Connection.php).

tried to apply patch in #21 but it fails with 'patch does not apply'.
running now 8.6.10 on my test site and 8.6.0 on my prod site. Both have same issue.

Anyone an idea how to fix this?

baysaa’s picture

@Luc the patch in #21 is against 8.6.x-dev, so most likely 'git apply' will complain. Can you try with 'patch -p1 < file.patch', if it's just fuzz then you can reroll a patch against 8.6.10 with git diff

Edit: Or just update to 8.6.11 :)

rolf van de krol’s picture

I got the same issue after an update. The problem seems to be that the content of the empty display of a view used to be an array with a value and a format key, but now should be just a string. In my installation, this was only an issue with the watchdog view. So i fixed it in drush php with:

$entityTypeManager = \Drupal::service('entity_type.manager');
$storage = $entityTypeManager->getStorage('view');
$watchdog = $storage->load('watchdog');
$display = &$watchdog->getDisplay('default');
$display['display_options']['empty']['area']['content'] = $display['display_options']['empty']['area']['content']['value'];
$watchdog->save();

It feels a bit hackish, but it works.

quotientix’s picture

Thanks Rolf, uninstalling DB logging fixed it for me!

jmbsvicetto’s picture

I've been hit by both issues 2999869 and 3039586.
When updating from drupal 8.6.15 to 8.7.1, I initially hit issue 2999869 and on following attempts I hit issue 3039586.
I ended up tracing the issue to having only the PT language installed on the drupal instance. After installing the EN language (and after removing the tmp_* and old_* tables), I was finally able to update without hitting any issues.

greatmatter’s picture

I stumbled across this post after searching for the same error, so hopefully this helps someone...in my case, I was calling
{{ drupal_view('featured_masonry', 'block_1', [node.id]) }}
instead of
{{ drupal_view('featured_masonry', 'block_1', node.id) }}

tuwebo’s picture

Hello,
I think this issue could be a duplicated of the related issue #2998103: dblog_update_8600() breaks views.view.watchdog config entity, leading to PHP warning on admin/reports/dblog and configuration import errors. The issue has been updated and it might be worth to take a look at it.
Basically it seems that dblog_update_8600() introduced a "wrong" configuration for views.view.watchdog empty area plugin type. This could lead to some errors mentioned in this issue.
Maybe just a quick "dirty" workaround for testing it is changing docroot/core/modules/dblog/config/optional/views.view.watchdog.yml configuration entity.
FROM

      empty:
        area:
          id: area_text_custom
          table: views
          field: area_text_custom
          relationship: none
          group_type: group
          admin_label: 'No log messages available.'
          empty: true
          tokenize: false
          content: 'No log messages available.'
          plugin_id: text_custom

TO

      empty:
        area_text_custom: // <----- NOTE here about using the proper plugin type.
          id: area_text_custom
          table: views
          field: area_text_custom
          relationship: none
          group_type: group
          admin_label: 'No log messages available.'
          empty: true
          tokenize: false
          content: 'No log messages available.'
          plugin_id: text_custom

Reviews or comments will be very welcome, it is something we are facing and hard to debug.

The issue came (in my use case) when installing a site in a non english language and enabling a custom module, which has nothing to do with watchdog but... then Locale module hooks into locale_modules_installed() and executes locale_system_set_config_langcodes() trying to save the watchdog view component in french language as this piece of code states

      if (!$config->isNew()) {
        $langcode = $config->get('langcode');
        if (empty($langcode) || $langcode == 'en') {
          $config->set('langcode', $default_langcode)->save();
        }
      }

leading to the
Placeholders must have a trailing [] if they are to be expanded with an array of values InvalidArgumentException error since the watchdog view has already a "wrong" configuration.

andypost’s picture

Version: 8.6.1 » 8.8.x-dev

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

brunogox’s picture

Thanks TuWebO, replacing the word area for area_text_custom in docroot/core/modules/dblog/config/optional/views.view.watchdog.yml fixed it.

Armond’s picture

Thank you very much TuWebO!
The workaround works.

damien laguerre’s picture

Same here, I got this error after upgrading from Drupal 8.5.3 to 8.8.1.

So thank you TuWeBo, your workaround do the job!

lowfidelity’s picture

Thanks so much @TuWebO. Ran into the problem upgrading 8.6.x to 8.8.1 and #28 fixed it for me.

After running drush updb I got the error message. I wasn't sure if I had to reroll to the backup that was created before running updb. But I just edited the mentioned .yml file without rerolling the backup first. Running drush updb again finished with success.

tritof’s picture

Hi, same as before the "dirty" trick from TuWebO mentionned in #28 worked for me. Muchas gracias !

kecsi’s picture

#28 worked in db upgrade to 8.8.1 here too. Correct I have duo site lang as well.
Thank you @TuWebO appreciate your effort to add this comment here!

bramdriesen’s picture

The latest patch in the issue mentioned in #28 also fixed this problem for me (https://www.drupal.org/project/drupal/issues/2998103)

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

enrocean167’s picture

StatusFileSize
new515 bytes

The fix from #28 attached as a patch as this was still an issue in one of our installations.

kumar ashutosh’s picture

I am getting in Drupal 9.

InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (line 848 of core\lib\Drupal\Core\Database\Connection.php).

Thanks in advance

peterszanto’s picture

I got this message after trying upgrade 8.6.1 to 8.9.2: "remove_core_key post-update Remove core key from views
configuration". This patch worked for me. After the drush updb the alert dissapeared. Thanks a lot.

ivnish’s picture

#28 save my time

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

apolitsin’s picture

the same

rcodina’s picture

#28 and patch on #39 saved my time too. Thanks!

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

larowlan’s picture

Category: Bug report » Support request
Status: Active » Closed (outdated)
Issue tags: +Bug Smash Initiative

Sounds like we got to the bottom of this for folks some updates ago

Thanks all

quietone’s picture