Failed install still shows module as installed

Created on 19 February 2018, about 7 years ago
Updated 16 May 2025, 3 days ago

On 8.4.4. I was unable to install because a config entry was already there, likely from an earlier install of the module many moons ago:
'action' entity with ID 'message_delete_action' already exists

I manually removed the entry from the db and noticed that the module install had gone far enough that Drupal showed it as installed in /admin/modules. This was curious because the install actually errored out.

Wanting to see a clean install, I attempted an uninstall and received:

The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Drupal\Core\Database\DatabaseExceptionWrapper</em>: SQLSTATE[42S02]: Base table or view not found: 1146 Table &#039;site_dev.contact_message&#039; doesn&#039;t exist: SELECT base_table.id AS id, base_table.id AS base_table_id
FROM 
{contact_message} base_table
LIMIT 1 OFFSET 0; Array
(
)
 in <em class="placeholder">Drupal\Core\Entity\EntityStorageBase-&gt;hasData()</em> (line <em class="placeholder">515</em> of <em class="placeholder">core/lib/Drupal/Core/Entity/EntityStorageBase.php</em>). <pre class="backtrace">Drupal\Core\Database\Statement-&gt;execute(Array, Array) (Line: 625)
Drupal\Core\Database\Connection-&gt;query(&#039;SELECT base_table.id AS id, base_table.id AS base_table_id
FROM 
{contact_message} base_table
LIMIT 1 OFFSET 0&#039;, Array, Array) (Line: 87)
Drupal\Core\Database\Driver\mysql\Connection-&gt;query(&#039;SELECT base_table.id AS id, base_table.id AS base_table_id
FROM 
{contact_message} base_table
LIMIT 1 OFFSET 0&#039;, Array, Array) (Line: 510)
Drupal\Core\Database\Query\Select-&gt;execute() (Line: 258)
Drupal\Core\Entity\Query\Sql\Query-&gt;result() (Line: 77)
Drupal\Core\Entity\Query\Sql\Query-&gt;execute() (Line: 515)
Drupal\Core\Entity\EntityStorageBase-&gt;hasData() (Line: 43)
Drupal\Core\Entity\ContentUninstallValidator-&gt;validate(&#039;contact&#039;) (Line: 561)
Drupal\Core\Extension\ModuleInstaller-&gt;validateUninstall(Array) (Line: 99)
Drupal\Core\ProxyClass\Extension\ModuleInstaller-&gt;validateUninstall(Array) (Line: 121)

This leaves the /admin/modules/uninstall stuck showing this error until I create the table with:

CREATE TABLE `contact_message` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `created` int(11) DEFAULT NULL,
  `uid` int(11) DEFAULT NULL,
  `ip_address` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Then the Uninstall Module page comes up.

But before I cleared the error above I attempted to uninstall the module manually. I could not find an entry for system.schema | contact_manager in the key_value table.

The following:
drush ev "\Drupal::service('config.manager')->uninstall('module', 'contact_manager');"

gave the warning below and didn't change the status in /admin/modules:

 [warning] The following module is missing from the file system: contact_manager bootstrap.inc:250

Clearly, there is something I don't know about regarding module installation.

Once I created the contact_message table above, I was able to successfully uninstall then install the module.

== Expected Behavior ==
1. If the installation errors out, the status of the module should not be set to "installed." That should be the last step. (Don't know if this is in the hands of the module maintainer.)
2. Failures in the uninstall should be explained with a message and continued. Again, this may be Drupal handling this, don't know.

== Issues ==
It appears there are two issues here:
1. A failed install still showed up to Drupal as installed.
2. The uninstall was unable to proceed when it didn't find the contact_message table above which necessitated a manual uninstall.

== Steps to Reproduce ==
1. Place an entry for system.action.message_delete_action in the config table.
2. Attempt an install. This should error out.
3. Attempt an uninstall. This, too, should error out.

Perhaps none of this is in your hands...

πŸ› Bug report
Status

Closed: outdated

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States aangel

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024