InvalidArgumentException... Class not Found after enabling module

Created on 19 April 2024, 8 months ago
Updated 2 May 2024, 8 months ago

Problem/Motivation

Trying to use this module to use it with the three column layout region style for specific block type.
ERROR
The website encountered an unexpected error. Try again later.

InvalidArgumentException: Class "\Drupal\layout_custom_section_classes\Form\GlobalSettingsForm" does not exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (line 24 of core\lib\Drupal\Core\DependencyInjection\ClassResolver.php).

Steps to reproduce

After successfully installing the module using composer, If I go to the path /config/content/layout-builder-section-attributes. getting the below message. my existing setup.
D10.2.4
PHP8.1.13
clear cache after installing and enabling module.
Also using layout builder style module with my current config.

Proposed resolution

I clear the cache using drush did not help, when I clear the cache using the drupal admin panel admin/config/development/performance solve the error message.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States oknaru

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

Comments & Activities

  • Issue created by @oknaru
  • πŸ‡¬πŸ‡§United Kingdom aaron.ferris

    Im unable to reproduce this, with/without the layout_builder_styles module also enabled.

    1. Drupal 10.2.4
    2. Latest version of this module via composer
    3. Enabled via drush
    4. The admin form loads as id expect

    I wonder if this was a strange install oddity? If it's resolved with a UI cache clear.

  • Status changed to Postponed: needs info 8 months ago
  • πŸ‡ΈπŸ‡°Slovakia kaszarobert

    I cannot reproduce this neither in dev neither in our production environment. I tried both Apache and Nginx+PHP-FPM configurations. Looking at the error message means that the mentioned PHP class could not be autoloaded, meaning that PHP opcache, APC cache or Drupal's dependency injection container cache was not invalidated properly for some reason and the site is still not aware that there's a new class that should be autoloaded.
    I also did a quick search for this problem and while others also experiencing this after other random module installations, I could not find a reliable solution to this other than calling the same cache clear function as the UI does: https://www.drupal.org/project/drupal/issues/3225584#comment-14949206 πŸ’¬ InvalidArgumentException: Class does not exist when accessing settings form after drush install module Closed: outdated

  • πŸ‡ΊπŸ‡ΈUnited States oknaru

    Hi All, Anyone who encounter this problem, Please login to your admin console and try clear cache from the admin console to fix the issue. When I try clear cache from Drush after module installation I was having the above issue. Please close this.

  • Status changed to Closed: works as designed 8 months ago
  • πŸ‡ΈπŸ‡°Slovakia kaszarobert

    Okay, closing this since it looks like it is not a problem with this module but with Drupal, class autoloading and caches not clearing the right way in certain PHP environments.

Production build 0.71.5 2024