Problem/Motivation

After upgrading to Drupal 10.6.x with Markdown 3.1.0, accessing /admin/config/content/markdown results in a fatal ServiceCircularReferenceException error that crashes the page:

Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: 
Circular reference detected for service "access_manager", path: 
"redirect.request_subscriber -> redirect.checker -> access_manager -> 
paramconverter_manager -> paramconverter.markdown -> 
plugin.manager.markdown.allowed_html -> exception.custom_page_html -> access_manager"

The circular dependency is caused by the paramconverter.markdown service being instantiated during container compilation in Drupal 10.4+. When instantiated, it requires plugin.manager.markdown.allowed_html, which inherits a setContainer() call from its parent class. This creates a circular dependency back to access_manager.

Root cause: Changes in Drupal 10.4+ core altered when param converter services are instantiated during the container compilation process, exposing this circular dependency that was latent in earlier versions.

Tested on:

  • Drupal 10.6.10
  • Markdown 3.1.0
  • league/commonmark 2.8.2

Steps to reproduce

  1. Install Drupal 10.6.x
  2. Install Markdown 3.1.0 with league/commonmark 2.8.x
  3. Navigate to /admin/config/content/markdown
  4. Page fails to load with ServiceCircularReferenceException

Note: This does NOT affect:

  • Markdown rendering/parsing functionality
  • Cron execution
  • Content display

Only the admin configuration pages are affected due to the route param converter triggering early service instantiation.

Proposed resolution

Make the paramconverter.markdown service lazy-loaded to prevent instantiation during container compilation. This breaks the circular dependency chain without affecting functionality.

Patch: Add lazy: true to the service definition in markdown.services.yml:

paramconverter.markdown:
  lazy: true
  class: Drupal\markdown\ParamConverter\MarkdownParamConverter
  arguments:
    [
      '@config.factory',
      '@plugin.manager.markdown.parser',
      '@plugin.manager.markdown.extension',
      '@plugin.manager.markdown.allowed_html',
    ]
  tags:
    - { name: paramconverter, priority: 10 }

After applying this change, you must generate the proxy class:

php core/scripts/generate-proxy-class.php 'Drupal\markdown\ParamConverter\MarkdownParamConverter' "modules/contrib/markdown/src"

Testing: Patch has been tested and confirmed to resolve the circular dependency. Admin pages load successfully, cron continues to work, and markdown parsing functions normally.

Credit: Issue investigation and resolution developed with assistance from Claude AI (Anthropic).

Remaining tasks

  • Review and test proposed patch
  • Confirm proxy class generation works correctly
  • Test with Drupal 11.x

User interface changes

None - fixes admin page access

API changes

None - internal service configuration only

Data model changes

None

Comments

jasonluttrell created an issue. See original summary.

jasonluttrell’s picture

Issue summary: View changes
jasonluttrell’s picture

jasonluttrell’s picture

Updated patch to include pre-generated proxy class, eliminating the warning entirely. Tested on Drupal 10.6.10 with no warnings or errors.

(Again, this was created with assistance from Claude Code. Please help verify.)