Internal Server Error from UnicodeDecodeError


#1

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/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](https://github.com/foosel/OctoPrint/issues/**req.view_args)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/views.py", line 398, in index
response = default_view()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/views.py", line 384, in default_view
return preemptively_cached()
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 895, in decorated_function
return f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 949, in decorated_function
return f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 682, in decorated_function
rv = f_with_duration(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 651, in f_with_duration
return f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 904, in decorated_function
rv = f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 920, in decorated_function
rv = f(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/views.py", 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/templating.py", line 128, in render_template
context, ctx.app)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/templating.py", line 110, in _render
rv = template.render(context)
File "/home/pi/oprint/local/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
File "/home/pi/oprint/local/lib/python2.7/site-packages/jinja2/environment.py", 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/jinja2.py", line 186, in _render_assets
urls = bundle.urls()
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/bundle.py", 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/bundle.py", line 765, in _urls
*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/bundle.py", line 619, in _build
force, disable_cache=disable_cache, extra_filters=extra_filters)
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/bundle.py", line 543, in _merge_and_apply
kwargs=item_data)
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/merge.py", line 276, in apply
return self._wrap_cache(key, func)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 219, in fixed_wrap_cache
content = self.cache.get(key)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 182, in fixed_get
hash = make_md5(self.V, key)
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/cache.py", line 84, in make_md5
for d in walk(data):
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/cache.py", line 61, in walk
for d in walk(item): yield d
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/cache.py", line 61, in walk
for d in walk(item): yield d
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/cache.py", line 67, in walk
yield obj.data().encode('utf-8')
File "/home/pi/oprint/local/lib/python2.7/site-packages/webassets/merge.py", line 79, in data
return f.read()
File "/home/pi/oprint/lib/python2.7/codecs.py", 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


#2

Please format your logs in the future.


#3

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."

Jeff


#4

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.