Skip to content

TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'NoneType' #6264

@joshooaj

Description

@joshooaj

Context

No response

Bug description

When using the latest available version of the mkdocs-material-insiders theme in a debian bullseye devcontainer, I cannot build/serve/publish with the blog plugin enabled without getting the following error.

It appears similar to #5881 in that my environment has a <3.10 version of python (3.9.2) and the info plugin cannot package the reproduction while the blog plugin is enabled. So heads up - in the attached reproduction I have commented out the blog plugin.

PS /workspaces/mkdocs-bug> mkdocs build
Traceback (most recent call last):
  File "/usr/local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/__main__.py", line 283, in build_command
    cfg = config.load_config(**kwargs)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/base.py", line 378, in load_config
    errors, warnings = cfg.validate()
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/base.py", line 230, in validate
    run_failed, run_warnings = self._validate()
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/base.py", line 188, in _validate
    self[key] = config_option.validate(value)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/config_options.py", line 182, in validate
    return self.run_validation(value)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/config_options.py", line 1064, in run_validation
    self.load_plugin_with_namespace(name, cfg)
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/config_options.py", line 1102, in load_plugin_with_namespace
    return (name, self.load_plugin(name, config))
  File "/usr/local/lib/python3.9/dist-packages/mkdocs/config/config_options.py", line 1120, in load_plugin
    plugin_cls = self.installed_plugins[name].load()
  File "/usr/local/lib/python3.9/dist-packages/importlib_metadata/__init__.py", line 209, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/local/lib/python3.9/dist-packages/material/plugins/blog/plugin.py", line 50, in <module>
    from .structure import Archive, Category, Excerpt, Reference, Post, View
  File "/usr/local/lib/python3.9/dist-packages/material/plugins/blog/structure/__init__.py", line 42, in <module>
    from .markdown import ExcerptTreeprocessor
  File "/usr/local/lib/python3.9/dist-packages/material/plugins/blog/structure/markdown.py", line 31, in <module>
    class ExcerptTreeprocessor(Treeprocessor):
  File "/usr/local/lib/python3.9/dist-packages/material/plugins/blog/structure/markdown.py", line 34, in ExcerptTreeprocessor
    def __init__(self, page: Page, base: Page | None = None):
TypeError: unsupported operand type(s) for |: 'ABCMeta' and 'NoneType'

Related links

Reproduction

9.4.7+insiders.4.42.3-blog-plugin-typeerror.zip

Steps to reproduce

  1. Use the 9.4.7+insiders.4.42.3 release of mkdocs-material-insiders.
    • I'm specifically installing using the syntax pip install git+https://github.com/squidfunk/mkdocs-material-insiders.git but it looks like I also get the same error when using the build associated with the 9.4.7+insiders.4.42.3 tag connected to the published release.
  2. Include the blog plugin in the list of plugins in mkdocs.yml
  3. Optional: Scaffold the blog folder and first post. In testing, it ended up not mattering if the blog folder was present under docs/ as the error occurs on __init__.
  4. Run mkdocs build

Browser

No response

Before submitting

Metadata

Metadata

Assignees

Labels

bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions