UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 1302: invalid start byte

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: fastcloud.co.za

I ran this command:
sudo certbot --nginx

It produced this output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
An unexpected error occurred:
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 1302: invalid start byte
Please see the logfiles in /var/log/letsencrypt for more details.

Copy from logfile:
2020-05-31 15:22:30,074:DEBUG:certbot.main:certbot version: 0.31.0
2020-05-31 15:22:30,075:DEBUG:certbot.main:Arguments: [’–nginx’]
2020-05-31 15:22:30,076:DEBUG:certbot.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#manual,PluginEntryPoint#nginx,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2020-05-31 15:22:30,088:DEBUG:certbot.log:Root logging level set at 20
2020-05-31 15:22:30,089:INFO:certbot.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2020-05-31 15:22:30,089:DEBUG:certbot.plugins.selection:Requested authenticator nginx and installer nginx
2020-05-31 15:22:30,107:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
File “/usr/bin/certbot”, line 11, in
load_entry_point(‘certbot==0.31.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1365, in main
return config.func(config, plugins)
File “/usr/lib/python3/dist-packages/certbot/main.py”, line 1101, in run
installer, authenticator = plug_sel.choose_configurator_plugins(config, plugins, “run”)
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 225, in choose_configurator_plugins
authenticator = installer = pick_configurator(config, req_inst, plugins)
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 25, in pick_configurator
(interfaces.IAuthenticator, interfaces.IInstaller))
File “/usr/lib/python3/dist-packages/certbot/plugins/selection.py”, line 106, in pick_plugin
verified.prepare()
File “/usr/lib/python3/dist-packages/certbot/plugins/disco.py”, line 251, in prepare
return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
File “/usr/lib/python3/dist-packages/certbot/plugins/disco.py”, line 251, in
return [plugin_ep.prepare() for plugin_ep in six.itervalues(self._plugins)]
File “/usr/lib/python3/dist-packages/certbot/plugins/disco.py”, line 132, in prepare
self._initialized.prepare()
File “/usr/lib/python3/dist-packages/certbot_nginx/configurator.py”, line 152, in prepare
self.parser = parser.NginxParser(self.conf(‘server-root’))
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 38, in init
self.load()
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 45, in load
self._parse_recursively(self.config_root)
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 56, in _parse_recursively
trees = self._parse_files(filepath)
File “/usr/lib/python3/dist-packages/certbot_nginx/parser.py”, line 207, in _parse_files
parsed = nginxparser.load(_file)
File “/usr/lib/python3/dist-packages/certbot_nginx/nginxparser.py”, line 123, in load
return loads(_file.read())
File “/usr/lib/python3.6/codecs.py”, line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x96 in position 1302: invalid start byte
2020-05-31 15:22:30,109:ERROR:certbot.log:An unexpected error occurred:

My web server is (include version):
nginx/1.14.0 (Ubuntu)

The operating system my web server runs on is (include version):
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic

My hosting provider, if applicable, is:
Self

I can login to a root shell on my machine (yes or no, or I don’t know):
Yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel):
No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):
certbot 0.31.0

1 Like

Hi @FASTCLOUD

check your nginx config files if there is a non-Ascii character.

May be the ` (GRAVE ACCENT) or another character, that's codepage specific.

1 Like

A way to locate the line it’s on might make it easier for you:

grep -RP "\x96" /etc/nginx/

The Unicode problems with the nginx plugin were fixed in 1.4.0, but that release is not available in the Ubuntu PPA.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.