Skip to content

Empty mkdocs_theme.yml breaks build #3699

@theacodes

Description

@theacodes

Hello! In the docs its stated that a theme can have an empty mkdocs_theme.yml file:

However, if the theme offers no configuration options, the file is still required and can be left blank.

Unfortunately this seems to have changed recently and now themes with empty mkdocs_theme.yml files are causing an exception when building:

> mkdocs build --verbose
DEBUG   -  Loading configuration file: ./mkdocs.yml
DEBUG   -  Loaded theme configuration for 'custom_theme' from
           './venv/lib/python3.12/site-packages/custom_theme/mkdocs_theme.yml':
           None
Traceback (most recent call last):
  [...]
  File "./venv/lib/python3.12/site-packages/mkdocs/config/config_options.py", line 868, in run_validation
    return theme.Theme(**theme_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./venv/lib/python3.12/site-packages/mkdocs/theme.py", line 61, in __init__
    self._load_theme_config(name)
  File "./venv/lib/python3.12/site-packages/mkdocs/theme.py", line 143, in _load_theme_config
    if parent_theme := theme_config.pop('extends', None):
                       ^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'pop'

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