Skip to content

ERROR - unexpected error: SuperFencesCodeExtension.extend_super_fences() missing 1 required positional argument: 'reset #76

Open

Description

@johnpiers

I ran an "update" (uv pip install --upgrade mkdocs-materialx) and it updated - pymdown-extensions==12.0.1 to + pymdown-extensions==12.1 and on restarting the server, got few hundred of these:

ERROR - unexpected error: SuperFencesCodeExtension.extend_super_fences() missing 1 required positional argument: 'reset'

To fix it I just reverted the change back to "12.0.1"

Clarification on the root cause:

The mkdocs-markmap plugin isn't bundled directly into this (MaterialX) theme's core repository.

The error occurs for users who have installed mkdocs-markmap in their local setups alongside mkdocs-materialx. The mkdocs-markmap extension hooks into pymdownx.superfences, which breaks globally on every page when pymdown-extensions automatically updates to v12.1+ due to a required 4th positional argument (reset) missing from the plugin's code.

Leaving this note here for anyone else using this (MaterialX) theme boilerplate who hits the same server crash—pinning pymdown-extensions==12.0.1 locally safely bypasses the issue until the markmap plugin gets an update.

Activity

  1. johnpiers commented on Sep 25, 2026

    @johnpiers
    Author

    Root cause, more precisely: pymdown-extensions 12.1 changed SuperFencesCodeExtension.extend_super_fences() to require a 4th positional argument, reset (a callback for clearing any state a custom fence type holds between renders — 12.1 defaults to a no-op, default_reset, for its own built-in custom fences when nothing else is given). extension.py here only ever calls it with 3 arguments, which is what throws on 12.1+.

    A version-tolerant fix, tested against both 12.0.1 and 12.1:

    try:
        from pymdownx.superfences import default_validator, fence_code_format, _formatter, _validator
        try:
            # pymdown-extensions 12.1+ requires a 4th 'reset' argument
            from pymdownx.superfences import _reset, default_reset
            extension.extend_super_fences(
                "markmap",
                partial(_formatter, class_name="language-markmap", _fmt=fence_code_format),
                partial(_validator, validator=default_validator),
                partial(_reset, _reset=default_reset)
            )
        except ImportError:
            # pymdown-extensions < 12.1 has no 'reset' argument
            extension.extend_super_fences(
                "markmap",
                partial(_formatter, class_name="language-markmap", _fmt=fence_code_format),
                partial(_validator, validator=default_validator)
            )
        break
    
    except ImportError as e:
        log.warning(f"markmap detected pymdownx.superfences, but import is not working: {e}")

    This works on both 12.0.1 and 12.1+, so no pinning is needed once it's in.
    Happy to open a PR if that's useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions