Internal Server Error from UnicodeDecodeError


What is the problem?
The problem is a internal server error related to following log output

2018-10-20 08:40:44,874 - octoprint - ERROR - Exception on / [GET]
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/", line 398, in index
response = default_view()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/", line 384, in default_view
return preemptively_cached()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 895, in decorated_function
return f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 949, in decorated_function
return f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 682, in decorated_function
rv = f_with_duration(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 651, in f_with_duration
return f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 904, in decorated_function
rv = f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 920, in decorated_function
rv = f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/", line 371, in make_default_ui
r = make_response(render_template("index.jinja2", **render_kwargs))
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/", line 128, in render_template
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/", line 110, in _render
rv = template.render(context)
File "/home/pi/oprint/local/lib/python2.7/site-packages/jinja2/", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/home/pi/oprint/local/lib/python2.7/site-packages/jinja2/", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/templates/index.jinja2", line 14, in top-level template code
{% include 'stylesheets.jinja2' %}
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/templates/stylesheets.jinja2", line 3, in top-level template code
{% assets "css_plugins" %}{% endassets %}
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/ext/", line 186, in _render_assets
urls = bundle.urls()
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 806, in urls
urls.extend(bundle._urls(new_ctx, extra_filters, *args, **kwargs))
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 765, in _urls
*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 619, in _build
force, disable_cache=disable_cache, extra_filters=extra_filters)
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 543, in _merge_and_apply
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 276, in apply
return self._wrap_cache(key, func)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 219, in fixed_wrap_cache
content = self.cache.get(key)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/", line 182, in fixed_get
hash = make_md5(self.V, key)
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 84, in make_md5
for d in walk(data):
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 61, in walk
for d in walk(item): yield d
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 61, in walk
for d in walk(item): yield d
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 67, in walk
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/", line 79, in data
File "/home/pi/oprint/lib/python2.7/", line 314, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: invalid start byte

What did you already try to solve it?

I reinstalled octoprint by pip, checked the octopi sd card with a forced check on boot.
octoremote and octoprint-telegram are still working - so i assume the error is related to some ui stuff...

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, octoprint.log, serial.log or output on terminal tab, ...)
octopi: latest
octoprint 1.3.9


Please format your logs in the future.


Any update on this? I have it also in the logs, Octoprint is running as it is controlling an external 4 relay box after it boots. Only cannot get to it via the web interface. I get the log in page and then an internal server error;

"The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."



Switch to Safe Mode and see if everything works. If so, then one of your plugins could be the problem here.

If it were me, I think I would remote into the Raspberry and run sudo raspi-config, visit the localisation section and verify that both the locale and default locale are correctly set. In my case, that's "en_US.UTF-8" but yours might be different.