Class "Drupal\csv_serialization\EventSubscriber\CsvSubscriber" not found

Created on 13 August 2024, 3 months ago
Updated 4 September 2024, 3 months ago

Problem/Motivation

Upon upgrading from 4.0.0 to 4.0.1 I get the following error when trying to download packages (or to do almost anything, actually)

Error: Class "Drupal\csv_serialization\EventSubscriber\CsvSubscriber" not found in Drupal\Component\DependencyInjection\Container->createService() (line 261 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Drupal\Component\DependencyInjection\Container->get('csv_serialization.csvsubscriber') (Line: 105)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 157)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 57)
Drupal\advban\AdvbanMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Install the new version, try to update. Problem goes away when I revert to 4.0.0. I'm using Drupal 10.3.2.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Fixed

Version

4.0

Component

Code

Created by

🇺🇸United States peter pulsifer

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

Comments & Activities

  • Issue created by @peter pulsifer
  • Status changed to Postponed: needs info 3 months ago
  • 🇺🇸United States markdorison

    Hi @Peter pulsifer! Thanks for the bug report. Can you try clearing Drupal cache and see if you still see the same error? The CsvSubscriber class was removed in 🐛 PHP 8.1 deprecated function warning Fixed (included in 4.0.1) so it could be an issue where the cached objects are out of date.

  • 🇺🇸United States peter pulsifer

    I was unable to clear the cache with the UI because of the error. What I did was remove keep the 4.0.0 code in place but reference to the CsvSubscriber class in csv_serialization.services.yml, then clear the cache. After doing that I could upgrade to the full 4.0.1 version without a problem. It was very helpful to know where this problem came from. Thanks for the quick response!

  • Status changed to Closed: outdated 3 months ago
  • 🇺🇸United States markdorison

    No problem!

  • Status changed to Fixed 3 months ago
  • 🇨🇦Canada poker.ca

    Having had exactly this problem, I was grateful for the advice in #2 and #3. Thank you both!
    With that help, I was able to find web/modules/contrib/csv_serialization/csv_serialization.services.yml and make the necessary changes.
    That said, perhaps a note on the project page recommending users edit the yaml file and clear their cache BEFORE upgrading would heve been even more useful ;-)

  • 🇺🇸United States markdorison

    I would recommend clearing the cache with Drush (drush cache:rebuild) as the first step as opposed to modifying the services.yml but that's just my two cents!

  • 🇺🇸United States peter pulsifer

    Drush is probably the best option, if you can do it, but I am on a shared server with no shell access!

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

  • 🇮🇳India Jegan2668 Bangalore

    I too faced the same issue when updating the version from 4.0.0 to 4.0.1. But, no error logs displayed in backend and tried clear caching by using drush.

Production build 0.71.5 2024