Error message :
The website encountered an unexpected error. Please try again later.
ArgumentCountError: Too few arguments to function Drupal\twig_field_value\Twig\Extension\FieldValueExtension::__construct(), 0 passed in /app/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 and exactly 2 expected in Drupal\twig_field_value\Twig\Extension\FieldValueExtension->__construct() (line 44 of modules/composer/twig_field_value/src/Twig/Extension/FieldValueExtension.php).
Drupal\twig_field_value\Twig\Extension\FieldValueExtension->__construct() (Line: 262)
Drupal\Component\DependencyInjection\Container->createService(Array, 'twig_field_value.twig.extension') (Line: 176)
Drupal\Component\DependencyInjection\Container->get('twig_field_value.twig.extension', 1) (Line: 437)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 276)
Drupal\Component\DependencyInjection\Container->createService(Array, 'twig') (Line: 176)
Drupal\Component\DependencyInjection\Container->get('twig') (Line: 197)
Drupal::service('twig') (Line: 47)
twig_render_template('core/themes/seven/templates/classy/dataset/table.html.twig', Array) (Line: 384)
Drupal\Core\Theme\ThemeManager->render('table', Array) (Line: 422)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 435)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 201)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 241)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 242)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 132)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 164)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 709)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Rolled back to 2.0.0 and everything started working again.
This was seen when I tried to view the Image styles interface at : /admin/config/media/image-styles
Comments
Comment #2
sutharsan commentedDid you run update scripts? I expect that to clear the cache, which should prevent this.
Comment #3
steveoriolI get the same error message as alphex...
even after an "drush updb -y && drush cr"
I have D9.4.8 and PHP 8.0.23
and back to v2.0.0 ; it is working again.
Comment #4
pp.panatom commentedhad the same error
no errors on website, but with several drush commands, like drush cex or drush status
so i did cache rebuild via UI (not drush), after that the error was gone
Comment #5
hanan alasariI get the same error message for D9.4.8. need to back to v2.0.0.
Comment #6
jacqui.tenderwolf commentedI am also having this error after the upgrade, but not for all my sites, just one.
Comment #7
sutharsan commentedPerhaps this helps:
Comment #8
sutharsan commentedI can not reproduce the bug and can therefore not fix it without contributions. Either code that prevents the bug or steps to reproduce it.
Comment #9
pameeela commented@Sutharsan have you tried with PHP 8? I am getting the same error, it only goes away if I downgrade PHP to 7.4.
Comment #10
sutharsan commented@pameeela, I tried with both.
I can not reproduce with:
{{ content.body|field_raw['format'] }}Comment #11
alphex commentedI'm running ....
On Lando v3.6.5
Docker 4.8.1 (78998)
Drupal 9.4.8
PHP 8.0.19
10.4.21-MariaDB-1:10.4.21+maria~focal
nginx/1.16.1
-----
Setting my composer.json file to
"drupal/twig_field_value": "2.0.1",And running
composer update && lando drush cr && lando drush updb -y... I go and visit "/admin/config/media/image-styles" from my original error report, and.... no longer receive the error.
I normally run
lando drush crandlando drush updb -yafter any module changes... sooo, maybe we just need to do it a few more times :)When it doubt, clear cache -- again.
Thank you.
Comment #12
pp.panatom commented@sutharsan
the install hook (#7) worked for me
Comment #13
olekstkach commentedComment #14
sutharsan commentedPlease explain why an install hook is the solution to the problem. This patch is not the same as the proposed solution in #7
Comment #15
pyretta commentedHi,
I also can't run the update via composer.
Page is completely unusable afterwards (frontend & backend): "The website encountered an unexpected error. Please try again later."
Drupal: 9.4.8
PHP: 8.1.10
DB: 8.0.30 MySQL, Percona Server
Composer: 2.2.6
Drush: 11.0.5
In which file should the hook suggested in #7 be inserted as a workaround?
Do I need to create a separate module for this?
here are the composer commands I used:
Maybe it helps to reproduce the error?
Comment #16
jim22 commentedSame issue. WSOD after update to 2.0.1. I've run drush updb and cr many times.
Drupal Version 9.4.7
PHP Version 8.0.23
hosted on Acquia Cloud, but interestingly enough I'm not getting WSOD/error in my local Lando env
Also tried following with no luck:
Reverting to 2.0.0 for now.
Pasting error:
ArgumentCountError: Too few arguments to function Drupal\twig_field_value\Twig\Extension\FieldValueExtension::__construct(), 0 passed in /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 and exactly 2 expected in /var/www/html/docroot/modules/contrib/twig_field_value/src/Twig/Extension/FieldValueExtension.php on line 44 #0 /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(262): Drupal\twig_field_value\Twig\Extension\FieldValueExtension->__construct()Comment #17
sutharsan commentedAlways clear the cache before you run the update script. See step 4 and 5 in https://www.drupal.org/docs/updating-drupal/updating-drupal-core-via-drush
Comment #18
cwyattjibc commentedI had the same error.
Drupal core 9.3.22
twig_field_value:2.0.1
PHP 7.4
I updated the database and cleared the cache and my site is back up.
I'm watching recent log messages to make sure the PHP error doesn't come back.
Comment #19
jim22 commentedUpdate: Apologies, I believe my issue was related to my server - ssh + drush. Clearing cache and running database updates fixes the error.
Comment #20
vrancjeI'm having the same error:
Drupal Version: 9.4.7
twig_field_value:2.0.1
PHP Version: 8.0.23
Also did updb and cr
Patch #13 works for me!
Comment #21
sutharsan commentedPatch #13 is a placebo, it does not actually do anything during update. Hook_install performs setup tasks when the module is installed.
I think the fact that it seems to work is that, during the process of trying again, an additional cache rebuild is performed.
I can only be convinced by instructions to reproduce the error, on ddev, a docker environment or a virtual machine.
Comment #22
loker commentedSame for me...
I'm using 9.4.8 with php 7.4.3 on Ubuntu. When I upgrade to the latest (2.0.1) I get
ArgumentCountError: Too few arguments to function Drupal\\twig_field_value\\Twig\\Extension\\FieldValueExtension::__construct(), 0 passed in (...)/Drupal/Component/DependencyInjection/Container.php on line 262 and exactly 2 expected in (...) web/modules/contrib/twig_field_value/src/Twig/Extension/FieldValueExtension.php on line 44 (...)
I have cleared the cache but it didn't help. I didn't understand the proposed solution on #7, where should I try that snippet?
Comment #23
loker commentedI have tried with 2.0.2 today, after upgrading the base system to 9.5 with hope, but this issue still exists.
ArgumentCountError: Too few arguments to function Drupal\\twig_field_value\\Twig\\Extension\\FieldValueExtension::__construct(), 0 passed in /(...)/core/lib/Drupal/Component/DependencyInjection/Container.php on line 263 and exactly 4 expected in /(...)/web/modules/contrib/twig_field_value/src/Twig/Extension/FieldValueExtension.php on line 67.
Comment #24
sutharsan commented@loker Have you cleared the cache after changing the code and before running the update script?
With drush:
or
Comment #25
loker commented@Sutharsan, yes I have cleared the cache with drush, and just to be sure with front end as well. The site I had problems with was a multi-site installation, maybe it had something to do with that, I don't know. As I couldn't find a solution, I took another path and uninstalled your module. Sorry.
Comment #26
WebbehWe had this happen with single-site installations in a limited hosting environment (higher-ed) without drush access (yes, I know, it's miserable).
For us problem environments, it's always helpful to have a cache invalidator during db-updates so that we don't immediately get a WSOD due to an outdated cache.
Comment #27
breezeweb commentedThis issue is still occurring in 2.0.2, reverting it back to 2.0.0 fixed it.
Comment #28
mohitgupta.ald commentedTried with version 2.0.2, did the drush updb from console, and then cleared out the cache from frontend but still received WSOD. Reverting it back to 2.0.0 fixed it.
Comment #29
mohitgupta.ald commentedIt will be great if someone provide any working patch from upgrading the module to 2.0.2.
Comment #30
WebbehAs a reminder, to fix this, we need to find a reproducible process to recreate this issue.
The steps should begin with: install Drupal using a default profile, install version 2.0.0, then upgrade, and see error; or, to find a process that reproduces this.
Comment #31
rick hood commentedI am getting errors.
Steps to reproduce (on my local using Lando):
1. composer update drupal/twig_field_value
Upgrading drupal/twig_field_value (2.0.1 => 2.0.2)
2. lando drush updb
[success] No pending updates.
3. I get errors on all page similar to error below
4. lando drush cr
Gets rid of the errors.
However, a concern is that I could not clear cache via the interface because this page also have errors: /admin/config/development/performance
I am holding off deploying this live for now.
....etc.
full output of errors is in the attached file.
Comment #32
grevil commentedIs this still a problem for latest dev?