squidfunk / mkdocs-material

Documentation that simply works
https://squidfunk.github.io/mkdocs-material/
MIT License
20.28k stars 3.48k forks source link

mkdocs build fails after upgrade to 5.5.15 (from 5.2.2) #1945

Closed buhrmann closed 3 years ago

buhrmann commented 3 years ago

Hi, after upgrading to mkdocs-material==5.5.14 my project doesn't build anymore. Reverting to 5.2.2 makes it work again, which is sufficient for me, but I thought it may be worth reporting. I don't have any custom templates. Maybe it is related to some version mismatch. I attach below the result of pip freeze in my conda environment, in case that's helpful.

I checked that...

Description

mkdocs build  

INFO    -  Cleaning site directory 
INFO    -  Building documentation to directory: /Users/thomas/code/cocktail/docs/public/site 
Traceback (most recent call last):
  File "/Users/thomas/anaconda/envs/docs/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/mkdocs/__main__.py", line 159, in build_command
    build.build(config.load_config(**kwargs), dirty=not clean)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/mkdocs/commands/build.py", line 288, in build
    _build_theme_template(template, env, files, config, nav)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/mkdocs/commands/build.py", line 114, in _build_theme_template
    output = _build_template(template_name, template, files, config, nav)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/mkdocs/commands/build.py", line 93, in _build_template
    output = template.render(context)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/material/404.html", line 4, in top-level template code
    {% extends "main.html" %}
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/material/main.html", line 4, in top-level template code
    {% extends "base.html" %}
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/material/base.html", line 7, in top-level template code
    {% set palette = palette | first %}
  File "/Users/thomas/anaconda/envs/docs/lib/python3.8/site-packages/jinja2/filters.py", line 510, in do_first
    return next(iter(seq))
TypeError: 'NoneType' object is not iterable

Expected behavior

Should build.

Actual behavior

Fails building.

Steps to reproduce the bug

mkdocs build

Package versions

Project configuration

site_name: Documentation
theme:
  name: material
  palette:
    # scheme: slate
  logo: images/logo.png
  favicon: images/favicon.png
  features:
    - tabs
    # - instant

plugins:
  - search:
      prebuild_index: true

extra_css:
  - style/custom.css
extra_javascript:
  - js/custom.js

markdown_extensions:
  - admonition
  - codehilite:
      guess_lang: false
  - footnotes
  - toc:
      permalink: true
      toc_depth: 3
  - markdown.extensions.attr_list
  - markdown.extensions.def_list
  - markdown.extensions.tables
  - pymdownx.superfences
  - pymdownx.tabbed
  - pymdownx.betterem:
      smart_enable: all
  - pymdownx.details
  - pymdownx.mark
  - pymdownx.inlinehilite
  - pymdownx.smartsymbols
  - pymdownx.emoji:
      emoji_index: !!python/name:materialx.emoji.twemoji
      emoji_generator: !!python/name:materialx.emoji.to_svg
nav:
    ...

Pip versions (pip freeze)

certifi==2020.6.20
click==7.1.2
future==0.18.2
importlib-metadata==2.0.0
Jinja2==2.11.2
livereload==2.6.3
lunr==0.5.6
Markdown==3.2.2
MarkupSafe==1.1.1
mkdocs==1.1
mkdocs-material==5.5.14
mkdocs-material-extensions==1.0
mkdocs-monorepo-plugin==0.4.10
mkdocs-redirects==1.0.1
nltk==3.4.5
Pygments==2.7.1
pymdown-extensions==8.0
PyYAML==5.3.1
six==1.15.0
tornado==6.0.4
zipp==3.2.0

System information

squidfunk commented 3 years ago

Duplicate of #1941.

buhrmann commented 3 years ago

Sorry, only checked the open issues...

squidfunk commented 3 years ago

Closing then, solutions are listed in the linked issue 😊

buhrmann commented 3 years ago

Yes, removing the emtpy palette: key works. Thanks.