Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When trying to install a profile containing configuration files from a Drupal 8.1.x site, the installation fails with the following error:
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'd8.key_value' doesn't exist: SELECT 1 AS expression FROM {key_value} key_value WHERE ( (name = :db_condition_placeholder_0) AND (collection = :db_condition_placeholder_1) ); Array ( [:db_condition_placeholder_0] => routing.menu_masks.router [:db_condition_placeholder_1] => state ) in Drupal\Core\State\State->set() (line 84 of /var/www/drupalvm/d8/core/lib/Drupal/Core/State/State.php).
Drupal\Core\State\State->set('routing.menu_masks.router', Array) (Line: 154)
Drupal\Core\Routing\MatcherDumper->dump(Array) (Line: 84)
Drupal\Core\ProxyClass\Routing\MatcherDumper->dump() (Line: 189)
Drupal\Core\Routing\RouteBuilder->rebuild() (Line: 83)
Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild() (Line: 626)
drupal_install_system(Array) (Line: 1035)
install_base_system(Array) (Line: 658)
install_run_task(Array, Array) (Line: 536)
install_run_tasks(Array) (Line: 115)
install_drupal(Object) (Line: 39)
If the config files are deleted from the profile directory, the installation succeeds, and the key_value table is created.
If one or two of the simpler config files, e.g. system.theme.yml, are restored, the installation also succeeds.
Comments
Comment #3
markaspot CreditAttribution: markaspot as a volunteer commentedMaybe check if the
core.extension.yml
is part of your configuration. Deleting this from the installation directory helped me getting rid of this kind of error.Comment #4
malcomio CreditAttribution: malcomio at Capgemini commentedThanks - that seems to have done the trick (at least for that error on my install).
It should probably be documented somewhere - with the docs changes, I'm not quite sure where though...
Comment #8
larowlanThanks, for this.
Adding some more keywords for google and closing
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'key_value' doesn't exist
Comment #10
lord_of_freaks CreditAttribution: lord_of_freaks commentedWorked for me too in 8.5.2 Thanks!
Comment #11
timmillwoodOver the past week we've been hitting this same issue with several sites.
Deleting core.extension.yml is not really an option. We're building sites then locally, committing all config along with contrib/custom modules to an install profile, then deploying to server and running a site install, where we get the same "'key_value' doesn't exist" issue. Therefore we want to keep the core.extension.yml config to make sure all modules are enabled on install.
Note: We're running Core 8.5.x with a patch from [#2788777#97], but actively working on testing core 8.6.x where we're also seeing the issue.
Comment #12
vijaycs85#11 +1 probably it's something #2788777-97: Allow a site-specific profile to be installed from existing config but I am seeing it now.
Comment #13
lpeabody CreditAttribution: lpeabody commentedI am also running into this issue and it's preventing site installs. We're built up on Acquia Cloud Site Factory, so we have many sites sharing the same set of configuration used for both installing new sites as well as updating existing sites, so removing core.extension.yml is simply not an option.Given that install from config is supported by core now, and you can't actually install from existing config on 8.6.x, I think this should probably be critical, yes?EDIT: False positive. You get a giant stack trace with the error, but if you scroll up more you might see something like:
So turns out you can't have hook_install if you're installing from config (makes sense I guess).
If your site install command is part of a script that does a cache-clear after the install (like mine does), then you would see the key_value error reported in the description.
Just wanted to post that in case other people ran into something similar and found their way here.
Comment #14
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedComment #17
oheller CreditAttribution: oheller at Electric Citizen commentedThis is still relevant today. The solution #3: delete core.extension.yml from myprofile/config/install solved my issue. I also needed to make sure all the modules and themes in core.extension.yml where in myprofile.info.yml.
See https://www.drupal.org/docs/distributions/creating-distributions/how-to-...
Comment #19
colanThe problem does indeed seem to be that
core.extension.yml
conflicts with the installation profile'sinfo.yml
. Logically, it doesn't even make sense to have both because they both do the same thing, decide which modules and themes get enabled. So how would the system know which one to use?#13 sounds like a red herring as we have one of those and it still works.
So I think the best way to fix this is to have some kind of check. If both of those files are there, issue an error stating that you can have only one, but not both. This is much better UX than crashing further down, forcing the user to do a Web search with the error, and then coming here.