Problem/Motivation
When I update CRM to beta12, the site crashes with the following error:
Problem/Motivation
Updating to CRM 1.0.0-beta12 crashes sites that do not have core
serialization enabled:
The website encountered an unexpected error. Try again later.
Error: Class "Drupal\serialization\Normalizer\ContentEntityNormalizer" not found in include() (line 18 of modules/contrib/crm/src/Normalizer/ContactNormalizer.php).
include() (Line: 576)
{closure:Composer\Autoload\ClassLoader::initializeIncludeClosure():575}() (Line: 427)
Composer\Autoload\ClassLoader->loadClass()
class_exists() (Line: 416)
Symfony\Component\DependencyInjection\ContainerBuilder->getReflectionClass() (Line: 27)
Symfony\Component\DependencyInjection\Compiler\AutowireAsDecoratorPass->process() (Line: 73)
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() (Line: 825)
Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1583)
Drupal\Core\DrupalKernel->compileContainer() (Line: 1040)
Drupal\Core\DrupalKernel->initializeContainer() (Line: 524)
Drupal\Core\DrupalKernel->boot() (Line: 751)
Drupal\Core\DrupalKernel->handle() (Line: 34)
Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() (Line: 32)
require() (Line: 22)
require_once() (Line: 13)REST integration (#3590472) added
Drupal\crm\Normalizer\ContactNormalizer, which extends
Drupal\serialization\Normalizer\ContentEntityNormalizer, and
registered crm.normalizer.contact unconditionally in
crm.services.yml. Container compilation then reflects that class
on every boot. If serialization is not installed, the parent class
is missing and the site cannot boot (web and Drush).
That crash is a real bug. Treating it as “CRM forgot to depend on
serialization” is the wrong product fix.
Proposed resolution
Serialization and REST must stay optional. CRM is a contact
relationship manager. Inline contact-method serialization and REST are
integrations for sites that enable those core modules. They must not become
required dependencies of CRM.
Expected behavior:
- CRM installs and boots with neither
serializationnor
restenabled. - Contact CRUD, relationship UI, and other non-REST features keep working
without those modules. - The contact normalizer (and any other class that extends Serialization
APIs) is registered only whenserializationis present. - Serialization settings, REST resource config, and related menu links
remain gated on the optional modules, as they already are for routes
(_module_dependencies: serialization). - Enabling
serialization(and REST, when wanted) turns the
integration on without a CRM reinstall.
Do not add drupal:serialization (or
drupal:rest) to crm.info.yml solely to paper over this
boot failure. That would force every CRM site to enable Serialization even
when they never use REST or JSON encoding of contacts.
The fix is to make the service definition conditional (for example a
CrmServiceProvider that registers
crm.normalizer.contact only when the Serialization module exists),
and to keep PHP that extends Serialization classes out of the always-loaded
container graph.
Remaining tasks
- Stop registering
crm.normalizer.contactwhen
serializationis not installed. - Confirm a site with CRM and without Serialization can boot after
update. - Confirm enabling Serialization still provides the contact normalizer and
settings UI. - Add coverage so this does not regress (Kernel or update path: CRM
without Serialization).
User interface changes
None for sites that already use Serialization. Sites without it should
continue to see no Serialization/REST CRM screens, and should no longer fatal
on boot.
API changes
No public API change. The contact normalizer remains an internal service
that exists only when Serialization is enabled.
The problem and possible solutions as generated by AI is:
### Cause of the Error
In **CRM `1.0.0-beta12`** (released September 12, 2026), feature issue `#3590472` (*Integration: ReST*) was introduced. As part of this change:
1. A new normalizer was added in [`ContactNormalizer.php`](/modules/contrib/crm/src/Normalizer/ContactNormalizer.php#L18):
class ContactNormalizer extends ContentEntityNormalizer {
which extends `Drupal\serialization\Normalizer\ContentEntityNormalizer` (from Drupal core's `serialization` module).
2. The service `crm.normalizer.contact` was registered unconditionally in [`crm.services.yml`](/modules/contrib/crm/crm.services.yml#L108-L117):
crm.normalizer.contact:
class: Drupal\crm\Normalizer\ContactNormalizer
...
tags:
- { name: normalizer, priority: 20 }3. **The upstream bug:** The maintainer did not add `drupal:serialization` to the `dependencies:` list in [`crm.info.yml`](/modules/contrib/crm/crm.info.yml), nor did they register the service conditionally in a `ServiceProvider` (only when `serialization` is installed).
Because the core `serialization` module is not enabled on your site, Drupal's autoloader does not register `Drupal\serialization\*`. When Drupal boots, Symfony compiles the dependency injection container and tries to reflect on `ContactNormalizer`, causing a fatal error.
Because container compilation fails on boot, **both web requests and Drush are blocked** in a chicken-and-egg loop.
---
### Solution 1: Enable the core `serialization` module (Recommended)
To unblock the site and enable `serialization`, follow these steps:
#### 1. Temporarily comment out the normalizer service
Open [`/modules/contrib/crm/crm.services.yml`](/modules/contrib/crm/crm.services.yml#L108-L117) and comment out lines 108–117:
# crm.normalizer.contact:
# class: Drupal\crm\Normalizer\ContactNormalizer
# arguments:
# - '@entity_type.manager'
# - '@entity_type.repository'
# - '@entity_field.manager'
# - '@crm.contact_serialization'
# - '@crm.contact_rest_write'
# tags:
# - { name: normalizer, priority: 20 }
#### 2. Enable Drupal's core `serialization` module
Now that Drupal can boot without crashing on `ContactNormalizer`, Drush will work again:
ddev drush pm:enable serialization --yes
#### 3. Uncomment the service in `crm.services.yml`
Restore lines 108–117 in [`/modules/contrib/crm/crm.services.yml`](/modules/contrib/crm/crm.services.yml) by uncommenting them:
crm.normalizer.contact:
class: Drupal\crm\Normalizer\ContactNormalizer
arguments:
- '@entity_type.manager'
- '@entity_type.repository'
- '@entity_field.manager'
- '@crm.contact_serialization'
- '@crm.contact_rest_write'
tags:
- { name: normalizer, priority: 20 }
#### 4. Rebuild cache, run updates, and export config
Run the following commands to rebuild the container, execute the `crm_post_update_install_rest_and_serialization_settings` update shipped in `1.0.0-beta12`, and export the updated extensions list to your sync directory:
ddev drush cache:rebuild
ddev drush update:db --yes
ddev drush config:export --yes
### Solution 2: Downgrade back to `1.0.0-beta11`
If you do not want to enable `serialization` or use the new REST integration features:
1. Comment out the service in [`crm.services.yml`](/modules/contrib/crm/crm.services.yml#L108-L117) temporarily as shown in Step 1 above so Composer/Drush can run cleanly.
2. Downgrade via Composer:
ddev composer require drupal/crm:1.0.0-beta11
ddev drush cache:rebuildIssue fork crm-3623019
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
tommynin commentedComment #3
tommynin commentedComment #4
bluegeek9 commentedComment #5
bluegeek9 commentedComment #8
bluegeek9 commentedComment #9
bluegeek9 commentedI am having trouble reproducing the issue. Which version of Drupal core did this happen with? Which version of PHP?
Comment #10
tommynin commentedDrupal Version
11.4.6
PHP Version:
8.4.20
Comment #11
tommynin commentedIf you go back to Beta 11, disable serialization and install Beta 12, the problem should appear.
If you update to Beta 12 with serialization enabled, the error does not happen.
Comment #12
bluegeek9 commentedI wasn't able to reproduce the bug. I am using ddev on x86_64.
I merged a change to the dev branch. If you can verify the change fixes the issue, I will create the beta13 release.
Comment #13
tommynin commentedHello. I was able to reliably reproduce the crash on a fresh, clean Drupal 11 (`drupal/recommended-project:^11`) installation:
1. Installed CRM `1.0.0-beta11`
composer require 'drupal/primary_entity_reference:^1.0@alpha' 'drupal/crm:1.0.0-beta11'
drush pm:install crm -y
2. Checked that serialization is disabled.
drush pm:list --filter=serialization
3. Did the upgrade to CRM beta12
composer require 'drupal/crm:1.0.0-beta12'
4. Attempt to run any Drush command or visit any page:
drush status
Result: Drupal crashes immediately during container compilation:
Error: Class "Drupal\serialization\Normalizer\ContentEntityNormalizer" not found in include()
(line 18 of modules/contrib/crm/src/Normalizer/ContactNormalizer.php)
The reason this didn't show up in your development environment is that serialization was likely already enabled in your site.
5. Verification of the fix in 1.0.x-dev
I tested the merged changes from the 1.0.x-dev branch against the current installation that was not working and before enabling serialization.
composer require 'drupal/crm:1.0.x-dev'
Ran drush cr and drush status.
Result: Drush and the site boot cleanly without any fatal errors.
6. Enabled serialization and tested again:
Ran drush pm:enable serialization -y.
Ran drush cr.
Result: serialization installs cleanly, and the normalizer is registered as expected without conflicts.
Everything is working as it should!!
Comment #14
bluegeek9 commentedI'll make a beta13 release today.