#252: 5 Common Errors in MkDocs and How to Avoid Them
When you are new to MkDocs you may find yourself in front of a few annoying problems. Before you turn your back on this tool, you should try the following troubleshooting tips.
Mapping values are not allowed here - invalid key
Especially when we start expanding our mkdocs.yaml file, we may run into this error:
ConfigurationError: MkDocs encountered an error parsing the configuration file: mapping values are not allowed here
We probably started with a basic setting and then added more configuration values. However, that only works if we append a : at the end of our key:
Make sure you add the : after your key (here pymdownx.highlight) to fix the error.
Error reading metadata of post - missing a more tag
If we set the option post_excerpt: required in our mkdocs.yaml, we end up with this error should we forget to add the <!-- more --> tag:
To fix this error, we need to add the divider for the post_excerpt:
Now MkDocs can build the site, and everything should work.
Old logos stay on the social cards and on the site – clear cache
If we generate the site and we find an old logo on the images for the social cards, we should delete the .cache folder next to the mkdocs.yaml file:
rm -rf .cache
The next time we generate the site we get a lot of warnings and errors. Wait until MkDocs builds the site and then run the build command again. The errors are now gone, and we have the new logo on our social cards and on our site.
The missing cairo library – follow the instructions
If we configure the image processing according to the documentation, we must follow the whole process. On one machine I got a strange situation. Everything worked the day I installed the Python packages, but the next day I only got this common error:
The fix is right there on the documentation site. I did not follow along everything because I could create the images. Prevent yourself from this silly mistake and make sure you install the other packages as well and add them to the path.
Code blocks are not rendered as code blocks – close code block on own line
If we write the markup by hand, we may end up with a code block that looks like this:

This is often the case if we put a closing part of code block not on its own line:
Put the 3 ``` on their own line and the code block shows up as intended:

This should now render your code block correctly:

Next
With the most common annoyances out of our way, we can enjoy writing our posts with MkDocs. We continue this series soon with more tricks. But first I must get a bit more experience to point out the helpful parts.
Next week we go back to Pandas and figure out how we can unpivot a pivot table.