I'm lovin' the Paragraphs module, just not on my current project. I've removed/deleted anything that has to do with a paragraph in any of my existing node types (using RC3) and waited, and run cron a bunch. But I still can't seem to clear up:

The following reason prevents Paragraphs from being uninstalled:
There is content for the entity type: Paragraph

Any tips on how I can scrape off the remaining paragraph barnacles so I can uninstall the module?

Comments

Todd Young created an issue. See original summary.

Todd Young’s picture

Some more info: I deleted *ALL* the content on the site. I was left with three files that were in File Fields in paragraphs, even though the paragraph types were deleted, as well as all nodes and node types. Looks like these three files are stuck in some orphaned paragraphs, and I have no "legit" interface to delete the files so I might have to get hacky with removing these associated files and the paragraphs themselves.

jeroen.b’s picture

Yeah, you probably have to delete those manually from the file usage.
Can you create a followup issue about the issue that file usage isn't correct after deleting paragraphs?

Todd Young’s picture

bcobin’s picture

I have the same issue as far as being unable to uninstall is concerned, but there are no orphaned files anywhere. I'm just testing out D8 at this point - is there anything I can do other than reinstalling Drupal? Thanks...

sdmeyers’s picture

I've had to do this a couple of times. Through trial and error this is what worked for me...

1. Remove all Paragraphs types.
2. Make sure you are not using any Paragraph fields in any content or content types.
3. browser your Drupal database and delete all the rows from the Paragraphs tables:
- paragraphs_item
- paragraphs_item_field_data
- paragraphs_item_revision
- paragraphs_item_revision_field_data
Don't just drop the tables or bad things will happen
4. You should now be able to uninstall the module normally.

zuernbernhard’s picture

Shouldn't the Module itself offer a posibillity to truncate the data from the backend ?

fkelly12054@gmail.com’s picture

sdmeyers, thank you! Just used phpmyadmin to truncate the four tables you listed, then could uninstall paragraphs. Now status report comes up clean. Agree with comment that module should give option to truncate the tables if someone really wants to uninstall.

miro_dietiker’s picture

For other modules such as Simplenews, we created some special admin UI button to prepare uninstall (=data deletion).
Simplenews example: #2418659: Can not uninstall: "Fields type(s) in use"
The origination is a known Core limitation and that's just a temporary workaround.

tduong’s picture

Assigned: Unassigned » tduong
Status: Active » Needs review
StatusFileSize
new4.03 KB
new57.31 KB
new64.66 KB
new70.42 KB
new177.03 KB

Starting codes: just added a settings page where you can find the "Prepare uninstall" page (similar to Simplenews example).
Tested manually and it works fine.

Here we don't specify for paragraph types/fields (like it is done in Simplenews, specified for Subscriber), because they are different scenarios (Simplenews provides contents and fields, while Paragraphs just provides contents, fields are provided by Entity Reference Revisions).
As @miro_dietiker has already mentioned, for now we can have this thing in admin/structure/paragraphs_type/settings/uninstall for Paragraphs, but instead of adding/keeping the N-th workaround in Contrib, we will have this kind of functionality in Core, so when you want to uninstall a module that have other dependencies, it will show you these informations and ask you to confirm to delete them as well on the same uninstall process without any trouble. This is already discussed long time ago, but AFAIK nobody has created the issue yet.

tduong’s picture

Test coverage: tomorrow ;)

tduong’s picture

Ok, actually there a a bunch of issues for that, but have different points of view: https://www.drupal.org/project/issues/drupal?text=uninstall
Not sure how we will manage it, but sure it will take long until it will be in Core. For now, for Paragraphs I guess is fine as I've shown in the previous comment. I'll upload the test soon!

tduong’s picture

StatusFileSize
new1.71 KB
new5.75 KB

Here we go: test_only = interdiff.

The last submitted patch, 13: cannot_uninstall_paragraphs-2609782-13-test_only.patch, failed testing.

The last submitted patch, 13: cannot_uninstall_paragraphs-2609782-13-test_only.patch, failed testing.

The last submitted patch, 13: cannot_uninstall_paragraphs-2609782-13-test_only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 13: cannot_uninstall_paragraphs-2609782-13.patch, failed testing.

The last submitted patch, 13: cannot_uninstall_paragraphs-2609782-13.patch, failed testing.

The last submitted patch, 13: cannot_uninstall_paragraphs-2609782-13.patch, failed testing.

tduong’s picture

Discussed with @Berdir and created Core issue for our case (entity types): #2688945: Allow removing a module's content entities prior to module uninstallation

berdir’s picture

Status: Needs review » Needs work
  1. +++ b/src/Tests/ParagraphsUninstallTest.php
    @@ -0,0 +1,57 @@
    +
    +use Drupal\search_api\Tests\WebTestBase;
    +
    

    That's the wrong class...

  2. +++ b/paragraphs.links.task.yml
    @@ -2,7 +2,21 @@ entity.paragraphs_type.edit_form:
    +
    +paragraphs.settings:
    +  title: Settings
    +  description: 'Paragraphs settings.'
    +  base_route: entity.paragraphs_type.collection
    +  route_name: paragraphs.settings_prepare_uninstall
    +
    +paragraphs.settings_prepare_uninstall:
    +  title: 'Prepare uninstall'
    +  description: 'Remove fields and data created by Paragraphs module.'
    +  base_route: entity.paragraphs_type.collection
    

    Just add a single local task directly to prepare uninstall, no need for settings and prepare uninstall

  3. +++ b/src/Tests/ParagraphsUninstallTest.php
    @@ -0,0 +1,57 @@
    +
    +use Drupal\search_api\Tests\WebTestBase;
    

    that's the wrong base class.

tduong’s picture

Status: Needs work » Needs review
StatusFileSize
new2.04 KB
new1.7 KB
new5.49 KB

Done.

tduong’s picture

StatusFileSize
new65.34 KB

New UI.

The last submitted patch, 22: cannot_uninstall_paragraphs-2609782-22-test_only.patch, failed testing.

The last submitted patch, 22: cannot_uninstall_paragraphs-2609782-22-test_only.patch, failed testing.

The last submitted patch, 22: cannot_uninstall_paragraphs-2609782-22-test_only.patch, failed testing.

miro_dietiker’s picture

Version: 8.x-1.0-alpha2 » 8.x-1.x-dev
Status: Needs review » Fixed
Issue tags: -Paragraphs Uninstall

Committed this.
Some people might not like the tab, but we need it in the current situation.

  • miro_dietiker committed df38a4a on 8.x-1.x authored by tduong
    Issue #2609782 by tduong: Trouble deleting and removing Paragraphs - can...
miro_dietiker’s picture

Status: Needs review » Fixed

Updating again an inconsistent state.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

geru’s picture

I have run into this same issue.

Between deleting all of my paragraphs types and paragraphs content types and also having the module prepare for uninstall, all of the paragraphs_item* tables were emptied.

I could not uncheck the paragraphs modules in the Extend admin interface in order to uninstall them.

Drush pm-uninstall worked until I reached the entity_reference_revisions module. On that one, drush balked with a field deletion error:

Drupal\Core\Extension\ModuleUninstallValidatorException: The following reasons prevent the modules [error]
from being uninstalled: Fields pending deletion in...

In PHPmyadmin, I found search_api_db_paragraphs_demo_index* tables from my experimentation, so I deleted them, but the uninstall still doesn't work. I'm leaving it for now. Perhaps it is an entity_reference_revisions problem.

johnchque’s picture

@geru can you write the whole exception message please? That could be really helpful to see what is the problem.

geru’s picture

I just did a fresh D8 install. I successfully installed and uninstalled Paragraphs. I also installed and uninstalled Paragraphs_demo.

When I try to uninstall entity_reference_revisions using drush, I get the following message:

The following extensions will be uninstalled: entity_reference_revisions
Do you really want to continue? (y/n): y
Drupal\Core\Extension\ModuleUninstallValidatorException: The following reasons  [error]
prevent the modules from being uninstalled: Fields pending deletion in
/srv/www/test.d8/core/lib/Drupal/Core/Extension/ModuleInstaller.php:354
Stack trace:
#0
/srv/www/test.d8/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91):
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#1 phar:///usr/local/bin/drush/commands/core/drupal/environment.inc(227):
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#2 phar:///usr/local/bin/drush/commands/core/drupal/pm_8.inc(82):
drush_module_uninstall(Array)
#3 phar:///usr/local/bin/drush/commands/pm/pm.drush.inc(1237):
_drush_pm_uninstall(Array)
#4 phar:///usr/local/bin/drush/includes/command.inc(366):
drush_pm_uninstall('entity_referenc...')
#5 phar:///usr/local/bin/drush/includes/command.inc(217):
_drush_invoke_hooks(Array, Array)
#6 phar:///usr/local/bin/drush/includes/command.inc(185):
drush_command('entity_referenc...')
#7 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#8 phar:///usr/local/bin/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#9 phar:///usr/local/bin/drush/includes/startup.inc(321): drush_main()
#10 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#11 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#12 {main}
berdir’s picture

You need to run cron, possibly multiple times (if you had a lot of data) until it it purges all the data in that field.

Deleting a field doesn't immediately delete all data, if you check your database, you'll see a new table that has a hash in it. You need to run cron until that table gets removed, basically.

geru’s picture

All I did was to enable the Paragraphs and Paragraphs Demo modules and then uninstall them.

The Paragraphs Demo module created content that remained after I had uninstalled the demo. I deleted that piece of content so there is no content at all in this test installation.

Running cron gives an error message indicating that the paragraph entity was not completely deleted.

drush cron
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "paragraph"      [error]
entity type does not exist. in
Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 125 of
/srv/www/test.d8/core/lib/Drupal/Core/Entity/EntityTypeManager.php).
Cron run successful.

It's not clear to me that running cron more times will change anything and the behavior when trying to uninstall entity_reference_revisions remains the same.

Benia’s picture

I typed "drush cron" 10 times and still can't remove Entity reference revisions.

dqd’s picture

Sorry for chiming in here but: I am even not able to delete a paragraph type. Even after deleting all content and all fields in the type and running drush cr, drush cron and drush up about 40 times ... (8.x-1.1+85-dev)

bcobin’s picture

I get the same error and this is on a "clean" site, where everything was up to date when I installed and uninstalled... theoretically. I'm running 9.4.8.

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "paragraph" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of [site]/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

If you try to remove a field, you get the error. Nasty. I have a hunch this has to do with the Paragraph Demo, nor Paragraphs per se.

It's been over five years - has anyone found a solution here? A search for "paragraph" in phpMyAdmin shows entries in the following tables:

cachtags
cache_config
cache_default
config
field_deleted_data
field_deleted_revision
key_value

To reproduce, create a field in a content type. Then delete it and you'll get the error.

Can anyone provide some guidance as to what I can do to fix this? I don't want to bork the site. Thanks in advance for any guidance...