I am trying to update drupal core from 8.2.8 to 8.3.1 alongwith lightning from 2.0.1 to 2.1.0. I've created the sub profile for lightning and executed all the manual steps mentioned here - https://github.com/acquia/lightning/blob/2.1.0/UPDATE.md. When running travis, I'm getting the below error
Error: Call to a member function getColumns() on boolean in /docroot/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php, line 228
After a bit of debugging I found that the error is coming from the below line and the reason for the error is that $field_storage is setting to FALSE here
$columns = $field_storage->getColumns();
System information before update:
- Drupal Version: 8.2.8
- Lightning Version: 2.0.1
System information after updating:
- Drupal Version: 8.3.1
- Lightning Version: 2.1.0
Comment | File | Size | Author |
---|---|---|---|
#53 | 2893747-53.patch | 2.58 KB | _utsavsharma |
#53 | interdiff_33-53.txt | 2.58 KB | _utsavsharma |
#50 | 2893747-50.patch | 1 KB | Ajeet Tiwari |
#33 | 2893747-33.patch | 2.59 KB | Tomefa |
#31 | interdiff_9-31.txt | 3.16 KB | raman.b |
Comments
Comment #2
gaurav.goyal CreditAttribution: gaurav.goyal at Acquia commentedAttached is the patch which fixes the issue. Added a check for $field_storage.
Comment #3
gaurav.goyal CreditAttribution: gaurav.goyal at Acquia commentedComment #5
kylethebaker CreditAttribution: kylethebaker commentedI'm running into the same issue. I have a custom entity that doesn't contain any 'fields', just entity properties. Trying to run an Entity Query against it causes this error to be thrown. Applying the patch worked for me.
My assumption is that it has to do with my entity not having any 'fields' (not sure what the proper terminology is here: I don't have any field tables for my entity, all of my fields are columns on the entity table defined as entity_keys in the annotation).
Comment #6
amateescu CreditAttribution: amateescu for Pfizer, Inc. commented@kylethebaker, can you paste the code of your custom entity type and the one for the entity query?
If we want to be able to fix this bug, we need to add a test for it, so we need some simple steps to reproduce that we can put into that test :)
Comment #7
kylethebaker CreditAttribution: kylethebaker commented@amateescu, here the repo for the module that contains just the custom entity: https://bitbucket.org/mygolfspy/mgs-swing-entity
I used drupal-console `generate:entity:content` and the only modification that I made is to the main entity file (src/Entity/SwingEntity.php).
The entity query is as follows:
I'll be able to do some debugging this weekend and see if I can figure out more, there might be an easier way to reproduce
Comment #8
kylethebaker CreditAttribution: kylethebaker commentedSome of my thoughts before I get too deep into debugging. Identical code to the one that is throwing the error in question also appears on line 151. See them both here:
Line 151 (identical code)
Line 227 (code that throws)
These identical code blocks appear in complementary if/else blocks. We have something like this:
Inside of this same `else` conditional there are other blocks where `$field_storage` is used, but in those cases it is wrapped in a check, similar to what the patch here applies. See the following lines where this happens:
Line 241
Line 251
So I think that in this case the check was just overlooked. Since the else block is handling cases where `$field_storage` may or may not be set, every call needs to be wrapped in a check.
Comment #9
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThanks @kylethebaker for the test module and for the actual query that you ran. The test module was unfortunately not very useful because the entity query didn't fail for me, but I was able to figure out the problem after trying out different scenarios.
The actual problem is that in a complex field name condition like
user_id.entity:user.name.value
, if theuser_id
field doesn't exist on the main entity type or thename
field doesn't exist on the referenced entity type, the fatal error described in the issue summary is thrown.In your case, I suspect that the
field_club_type
field didn't exist on the Node entity type.Anyway, here's a test-only patch that shows this fatal error and a better fix than #2, because that patch would simply result in an entity query that would never match what it was intended to.
Comment #11
kylethebaker CreditAttribution: kylethebaker commented@amateescu,
I have double checked and all of the entity fields used in the conditions exist on my end. Using your patch I'm able to run the query (successfully) without triggering the new exception, but if I change one of the field names to a non-existent one then I can see it trigger. If my fields didn't exist on Node entities then I should have seen the exception trigger the first time, right?
I can try starting from a clean install and recreating the bare minimum of my setup and see if I still encounter this, and if so share the config sync yaml with you so we can have identical environments. You said that the query didn't fail for you, so it's possible that there is something specific about my environment triggering this that is not reflected in what I've shared (the entity or the query).
Comment #12
amateescu CreditAttribution: amateescu for Pfizer, Inc. commented@kylethebaker,
Not necessarily :) I encountered a very interesting situation while writing the test for this bug, the fatal error only occurred when the problematic entity query was run *before* any other entity query, even one that was totally unrelated on a different entity type.
If you have the time to do that, yes, a minimal testing environment with just Drupal core, the module with your custom entity type, some fields on the Node entity type and some place to run that query that would fail consistently would help a lot with figuring out what the problem was in your specific case.
But if you can confirm that the patch from #9 fixes the fatal error (which you already did), and that the entity query returns the expected result, that's also helpful for getting this patch to RTBC :)
Comment #13
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedThis works for me on Drupal 8.4.2
Comment #14
larowlanWe should just throw the exception first.
This is the current logic of that method.
If we throw it right at the top, all the if statements are greatly simplified.
Comment #15
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedWhile I did not get the error that this patch solved after applying this patch, I got the following problem for smsframework:
https://www.drupal.org/node/2922029:
Drupal\Core\Entity\Query\QueryException: Invalid specifier 'entity__target_type' in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 289 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
and this one for scheduled_messages
https://www.drupal.org/project/scheduled_message/issues/2922310
Drupal\Core\Entity\Query\QueryException: Invalid specifier 'field_send_state' in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 289 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
Without the patch in this issue queue, the other errors go away the above error for scheduled_message and smsframework go away
Comment #16
jcmartinezAfter applying the patch #9, I get the following error message when I run cron using drush:
I'm on Drupal 8.4.3 and I'm using the Commerce module, Commerce License and Commerce Recurring.
Comment #17
heyyo CreditAttribution: heyyo commentedSame issue than in #10 when uninstalling Webform Demo.
Comment #18
d.novikov CreditAttribution: d.novikov as a volunteer commentedFaced the same issue with the simplenews module when running cron:
Drupal\Core\Entity\Query\QueryException: Invalid specifier 'simplenews_issue' in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 300 of .../core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
Comment #20
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedHere is how I am getting this error:
1. goto uninstall
2. uninstall a module like flag or linkback which has settings that are automatically added to fields or content types and also has it's own admin settings
3. select uninstall
4. I get a WSOD on the confirm page and the getColumn error in my logs
5. Go back to uninstall and uninstall the module again
You will notice that the field or node based settings have been uninstalled
When uninstall is run again it uninstalls the remaining admin settings
I find something similar if there are optional settings that need to be installed.
It's as if there is a three step process:
1) remove the module for fields or entities that it might have attached to
2) remove any optional settings
3) remove all other settings
also drush pm-uninstall does not perform as the uninstall page does and thus masks the steps above by leaving the configuration even though it has uninstalled the module
Comment #21
scottsawyercan anyone confirm the following:
Comment #23
cbovard CreditAttribution: cbovard commentedSubscribing.
Comment #24
KingdutchThe bug still exists. The patch no longer applies. The feedback from #14 still needs to be incorporated.
Also please use the "Subscribe" flag on the right to subscribe to an issue instead of commenting "Subscribe" :D Thanks!
Comment #25
jucedogi CreditAttribution: jucedogi commentedI'm using Drupal 8.7.2 and this is still a thing. Can't uninstall some modules after getting this error.
Comment #26
sandiaras CreditAttribution: sandiaras commentedPatch #9 works for me on Drupal 8.4.0
Comment #27
hans.p. CreditAttribution: hans.p. commentedHi,
just update my core site (to 8.7.6), this issue in still present.
Uninstalling modules does work, so that is fixed!
But now i got this error after trying to import feeds.
Error: Call to a member function getColumns() on boolean in Drupal\Core\Entity\Query\Sql\Tables->addField() (regel 252 van /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php) #0 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php(52): Drupal\Core\Entity\Query\Sql\Tables->addField('feeds_item.targ...', 'INNER', NULL) #1 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(172): Drupal\Core\Entity\Query\Sql\Condition->compile(Object(Drupal\Core\Database\Driver\mysql\Select)) #2 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(80): Drupal\Core\Entity\Query\Sql\Query->compile() #3 /data/sites/web/mydrupalsite/www/modules/feeds/src/Feeds/Processor/EntityProcessorBase.php(674): Drupal\Core\Entity\Query\Sql\Query->execute() #4 /data/sites/web/mydrupalsite/www/modules/feeds/src/Entity/Feed.php(508): Drupal\feeds\Feeds\Processor\EntityProcessorBase->getItemCount(Object(Drupal\feeds\Entity\Feed)) #5 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/EntityStorageBase.php(491): Drupal\feeds\Entity\Feed->preSave(Object(Drupal\feeds\FeedStorage)) #6 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(692): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\feeds\Entity\Feed)) #7 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/EntityStorageBase.php(446): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave(Object(Drupal\feeds\Entity\Feed)) #8 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(838): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\feeds\Entity\Feed)) #9 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Entity/EntityBase.php(394): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\feeds\Entity\Feed)) #10 /data/sites/web/mydrupalsite/www/modules/feeds/src/FeedForm.php(215): Drupal\Core\Entity\EntityBase->save() #11 [internal function]: Drupal\feeds\FeedForm->save(Array, Object(Drupal\Core\Form\FormState)) #12 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) #13 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #14 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Form/FormBuilder.php(590): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #15 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Form/FormBuilder.php(319): Drupal\Core\Form\FormBuilder->processForm('feeds_feed_occa...', Array, Object(Drupal\Core\Form\FormState)) #16 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Controller/FormController.php(93): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\feeds\FeedForm), Object(Drupal\Core\Form\FormState)) #17 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #18 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #19 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #20 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #21 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #22 /data/sites/web/mydrupalsite/www/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #23 /data/sites/web/mydrupalsite/www/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #24 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /data/sites/web/mydrupalsite/www/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /data/sites/web/mydrupalsite/www/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /data/sites/web/mydrupalsite/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /data/sites/web/mydrupalsite/www/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /data/sites/web/mydrupalsite/www/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #33 {main}.
any thoughts?
Comment #30
caspervoogt CreditAttribution: caspervoogt commented#9 solves this for me, on Drupal 8.9.2. I was unable to run cron before using this patch; it was failing with
Error: Call to a member function getColumns() on boolean in /docroot/core/lib/Drupal/Core/Entity/Query/Sql/Tables.php, line 228
.Comment #31
raman.b CreditAttribution: raman.b at OpenSense Labs commentedRe-rolling for the latest dev branch and addressing #14
Comment #33
Tomefa CreditAttribution: Tomefa as a volunteer commentedReroll patch #9 for drupal 8.9.7
Comment #34
Michael Zetterberg fd. Lopez CreditAttribution: Michael Zetterberg fd. Lopez at We ahead commentedThanks Tomefa, the patch in #33 helped me. It didn't solve my problem but it did give me a better error message stating what the real issue was. For us it was having renamed a field locally (see https://drupal.stackexchange.com/questions/250927/how-do-i-rename-a-fiel...) and not on staging and production servers.
Comment #35
GreenhornI have the same mistake. Drupal 8.9.9 and applied the patch from @Tomefa (patch # 33) and it worked. I hope there are no other problems.
Thanks @Tomefa.
Comment #36
niles38 CreditAttribution: niles38 commentedWe're running Drupal 8.9.11 and the patch in #33 worked for us. Thanks! Please put this in core. We had been getting this error a lot.
Comment #37
dgaspara CreditAttribution: dgaspara at NTT DATA commented#33 works for me. Thanks!
Comment #39
Renrhaf#33 works for me also. Thank you very much.
Running Drupal 9.2.2
Comment #41
johnfallen CreditAttribution: johnfallen commented#33 works for me also. Thanks!
Running Drupal 9.2.9
Comment #43
adimushi CreditAttribution: adimushi as a volunteer commented#33 worked for me as well. Thanks a lot!
Drupal core 9.4.5
Comment #45
gauravjeet CreditAttribution: gauravjeet as a volunteer and at Acquia commented#33 applies to Drupal 9.4.8
Comment #46
robcarrPatch #33 seemed to work initially, but then caused WSOD on 9.5.1 during login. Not sure why
Comment #47
JasonSafro CreditAttribution: JasonSafro commentedPlease check https://www.drupal.org/project/drupal/issues/3352880. I think it's related but different.
Comment #49
Ghost of Drupal PastTwo different errors are being mixed in this issue. One is in the title and at least one cause is field storage definitions might be missing in the last installed schema repository due to #3363732: entity.last_installed_schema.repository has a race condition.
The invalid specifier is a completely different one as far as I am able to tell.
Comment #50
Ajeet Tiwari CreditAttribution: Ajeet Tiwari at OpenSense Labs for DrupalFit commentedPlease review.
Comment #51
smustgrave CreditAttribution: smustgrave at Mobomo commentedRemoving credit for #50 as there was no interdiff but from the pervious file size something was lost.
There was no explanation for what was changed or why. If just a reroll that doesn't receive credit anymore either.
Also CC failure, expected to check patch before uploading.
#49 mentions things are getting mixed so maybe the issue summary should be updated too.
Comment #52
andileco CreditAttribution: andileco at JSI Research & Training Institute, Inc. (JSI) commentedI experienced this issue when I (config sync) imported a Feed type from one site to another and then tried to add a Feed of that type in my new site. By going to the Feed type, editing and saving it, I was then able to add the new Feed without the error. Would definitely be great to have this bug fixed, but this is a helpful workaround if you are stuck and don't want to apply a patch.
Comment #53
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs for DrupalFit commentedPatch for 11.x.