See #1897364: How the bleepity bleep do you debug plugin-related errors? :).

xjm asked me to file this because:


Drupal\Component\Plugin\Exception\PluginException: The plugin (ckeditor) did not specify an instance class. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 62 of /Users/webchick/Sites/spark/spork/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

should apparently have been something more like:

Hey, dummy. That plugin_id returned NULL.

Comments

xjm’s picture

Assigned: Unassigned » xjm

Yep.

eclipsegc’s picture

StatusFileSize
new1001 bytes

First pass at a patch.

As a side note, we cannot provide the Manager class that called this reliably because of: #1851706: Make all core plugin managers be consistent as to whether $this or $this->discovery is passed to the factory and apparently no amount of discussion will solve that. We also probably shouldn't spit out plugin definitions in the exceptions either. I don't know of a way that could be a security issue, but hey... you never know. It's also really hard to read. This patch at least makes a difference between "Your plugin didn't specify a class" and "Your plugin doesn't exist". That's probably the best we can do for the time being short of putting catch statements in the methods on the plugin manager to catch the messages and add the manager's name to them (which is possible, but also likely to be problematic with regard to #1851706: Make all core plugin managers be consistent as to whether $this or $this->discovery is passed to the factory and I can hear people screaming already about catching an exception just to throw it again).

Not sure what else we can do to improve this.

Eclipse

eclipsegc’s picture

Status: Active » Needs review
xjm’s picture

StatusFileSize
new960 bytes
new1.01 KB

I told @EclipseGc to say in the issue that he asked me about this in IRC to make it clear he wasn't ignoring issue etiquette, but he apparently forgot. ;)

#2 is approximately what I was doing, plus this.

webchick’s picture

Sigh. :( I stupidly accidentally blew away my site from the debug issue and now can't replicate the problem. :(

I manually adjusted getPluginClass() with a if ($plugin_id == 'ckeditor') { $plugin_definition = NULL; } and now the error back is:

Drupal\Component\Plugin\Exception\PluginException: The plugin (ckeditor) does not exist (Drupal\Core\Plugin\Discovery\CacheDecorator discovery). in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 63 of /Users/webchick/Sites/spark/spork/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

I'm not sure if CKEditor is just a weird one-off here, but CacheDecorator doesn't seem to be important/helpful at all to figuring out where the problem is.

I erased that debugging line and just put an unconditional $plugin_definition = NULL for everything and reload /node. That gives me:

Drupal\Component\Plugin\Exception\PluginException: The plugin (text_summary_or_trimmed) does not exist (Drupal\field\Plugin\Type\Formatter\FormatterPluginManager discovery). in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 64 of /Users/webchick/Sites/spark/spork/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

Here, FormatterPluginManager does seem to be a lot more relevant.

OTOH, if I go to user/1:

Drupal\Component\Plugin\Exception\PluginException: The plugin (image) does not exist (Drupal\field\Plugin\Type\Formatter\FormatterPluginManager discovery). in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 65 of /Users/webchick/Sites/spark/spork/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

Not sure about that one; seems kind of irrelevant again.

This is definitely a step in the right direction, but not sure I feel qualified to RTBC. The discovery seems to be hit and miss in terms of usefulness to debugging. I love the idea of putting *something* there, but I wonder if there's another property that might be more helpful?

webchick’s picture

Oh wait. That's FormatterPluginManager for both, because both are fields. For some reason (probably because it's stupid o'clock), I read the first as FormatPluginManager.

Yeah, I dunno. To me that discovery being there would just send me down a wild goose chase, as it already did in #1897364: How the bleepity bleep do you debug plugin-related errors? :), but am I missing something valuable?

neclimdul’s picture

jibran’s picture

#4: plugin_error-1897762-4.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, plugin_error-1897762-4.patch, failed testing.

rbayliss’s picture

Status: Needs work » Needs review
StatusFileSize
new973 bytes

Rerolled. No interdiff because I couldn't apply the patch from #4. We no longer have access to the discovery in this method, so I guess any arguments for or against printing the discovery mechanisms are a moot point now.

Status: Needs review » Needs work

The last submitted patch, plugin_error-1897762-10.patch, failed testing.

clemens.tolboom’s picture

xjm’s picture

Assigned: xjm » Unassigned
Issue summary: View changes

xjm does not know why she still has this assigned to herself.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Closed (outdated)