# Buggy code
def run_validation(self, value):
    if not isinstance(value, list):
        raise ValidationError("Expected a list, got {0}".format(type(value)))

    if len(value) == 0:
        return

    # TODO: Remove in 1.0
    config_types = set(type(l) for l in value)

    if config_types.issubset(
        set(
            [
                str,
                dict,
            ]
        )
    ):
        return value

    if config_types.issubset(
        set(
            [
                str,
                list,
            ]
        )
    ):
        return legacy.pages_compat_shim(value)

    raise ValidationError("Invalid pages config.")


# Traceback (UnicodeDecodeError)
Traceback (most recent call last):
File "/Users/maemual/Workspace/mkdocs/env/bin/mkdocs", line 9, in <module>
load_entry_point('mkdocs==0.13.0.dev0', 'console_scripts', 'mkdocs')()
File "/Users/maemual/Workspace/mkdocs/env/lib/python2.7/site-packages/click/core.py", line 664, in __call__
return self.main(*args, **kwargs)
File "/Users/maemual/Workspace/mkdocs/env/lib/python2.7/site-packages/click/core.py", line 644, in main
rv = self.invoke(ctx)
File "/Users/maemual/Workspace/mkdocs/env/lib/python2.7/site-packages/click/core.py", line 991, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/maemual/Workspace/mkdocs/env/lib/python2.7/site-packages/click/core.py", line 837, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/maemual/Workspace/mkdocs/env/lib/python2.7/site-packages/click/core.py", line 464, in invoke
return callback(*args, **kwargs)
File "/Users/maemual/Workspace/mkdocs/mkdocs/cli.py", line 83, in serve_command
livereload=livereload,
File "/Users/maemual/Workspace/mkdocs/mkdocs/serve.py", line 77, in serve
config = builder()
File "/Users/maemual/Workspace/mkdocs/mkdocs/serve.py", line 73, in builder
build(config, live_server=True)
File "/Users/maemual/Workspace/mkdocs/mkdocs/build.py", line 306, in build
build_pages(config)
File "/Users/maemual/Workspace/mkdocs/mkdocs/build.py", line 252, in build_pages
if not build_template('search.html', env, config, site_navigation):
File "/Users/maemual/Workspace/mkdocs/mkdocs/build.py", line 166, in build_template
output_content = template.render(context)
File "/Users/maemual/Workspace/mkdocs/env/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/Users/maemual/Workspace/mkdocs/env/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/maemual/Workspace/mkdocs/mkdocs/themes/readthedocs/search.html", line 1, in top-level template code
{% extends "base.html" %}
File "/Users/maemual/Workspace/mkdocs/mkdocs/themes/readthedocs/base.html", line 62, in top-level template code
<li>{% include "toc.html" %}<li>
File "/Users/maemual/Workspace/mkdocs/mkdocs/themes/readthedocs/toc.html", line 3, in top-level template code
<li><span>{{ nav_item.title }}</span></li>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

# Fixed code
def run_validation(self, value):
    if not isinstance(value, list):
        raise ValidationError("Expected a list, got {0}".format(type(value)))

    if len(value) == 0:
        return

    # TODO: Remove in 1.0
    config_types = set(type(l) for l in value)

    if config_types.issubset(
        set(
            [
                six.text_type,
                dict,
            ]
        )
    ):
        return value

    if config_types.issubset(
        set(
            [
                six.text_type,
                list,
            ]
        )
    ):
        return legacy.pages_compat_shim(value)

    raise ValidationError(
        "Invalid pages config. {0} {1}".format(
            config_types,
            set(
                [
                    six.text_type,
                    dict,
                ]
            ),
        )
    )