Unicode Encode Error

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.

I ran this command:
certbot --authenticator webroot --installer apache

It produced this output:
Waiting for verification…
Cleaning up challenges
An unexpected error occurred:
UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 240-241: ordinal not in range(128)

The operating system my web server runs on is (include version):
Debian 9

My hosting provider, if applicable, is:
ovh

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

Earlier it works normal for other domains. For now i get this: Obtaining a new certificate An unexpected error occurred:
There were too many requests of a given type :: Error creating new authz :: too many failed authorizations recently: see https://letsencrypt.org/docs/rate-limits/
Please see the logfiles in /var/log/letsencrypt for more details.

Another user had a similar problem recently:

Might be worth trying that grep command and seeing what happens.

grep -nRP '[\x80-\xFF]' /etc/apache2

issue still exists.

Using grep just (possibly) identifies an unicode issue, it cannot fix it.
What was the output of the command?

Waiting for verification...
Cleaning up challenges
An unexpected error occurred:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 240-241: ordinal not in range(128)
root@xxx:/etc# grep -nRP '[\x80-\xFF]' /etc/apache2

and nothing else

2018-09-16 13:40:58,092:DEBUG:certbot.main:Exiting abnormally:
Traceback (most recent call last):
  File "/usr/bin/certbot", line 11, in <module>
    load_entry_point('certbot==0.10.2', 'console_scripts', 'certbot')()
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 849, in main
    return config.func(config, plugins)
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 575, in run
    action, lineage = _auth_from_available(le_client, config, domains, certname)
  File "/usr/lib/python2.7/dist-packages/certbot/main.py", line 107, in _auth_from_available
    lineage = le_client.obtain_and_enroll_certificate(domains, certname)
  File "/usr/lib/python2.7/dist-packages/certbot/client.py", line 291, in obtain_and_enroll_certificate
    certr, chain, key, _ = self.obtain_certificate(domains)
  File "/usr/lib/python2.7/dist-packages/certbot/client.py", line 262, in obtain_certificate
    self.config.allow_subset_of_names)
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 77, in get_authorizations
    self._respond(resp, best_effort)
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 134, in _respond
    self._poll_challenges(chall_update, best_effort)
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 197, in _poll_challenges
    _report_failed_challs(all_failed_achalls)
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 488, in _report_failed_challs
    _generate_failed_chall_msg(achalls), reporter.MEDIUM_PRIORITY)
  File "/usr/lib/python2.7/dist-packages/certbot/auth_handler.py", line 504, in _generate_failed_chall_msg
    if messages.is_acme_error(error):
  File "/usr/lib/python2.7/dist-packages/acme/messages.py", line 39, in is_acme_error
    return (ERROR_PREFIX in str(err)) or (OLD_ERROR_PREFIX in str(err))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 240-241: ordinal not in range(128)

@virtuedressing, this is actually a known error about the case where your system fails an HTTP-01 challenge by sending something (like a 404 error page) other than the required challenge file. in this case the CA sends back this HTML content as part of the error message, but if that content contains a non-ASCII character then old versions of Certbot will crash exactly where you experienced. You are using Certbot 0.10.2, which is a very old version.

You could potentially upgrade to a new version (via certbot-auto or the PPA). Alternatively, you could just interpret this as an inconvenient way of being told “your Apache returned a 404 error instead of the required challenge file” and then try to debug from there (in this case because you specified the wrong webroot directory or because the directory you specified isn’t actually allowed to serve static files by your Apache configuration).

3 Likes

I’m sorry for the wild goose chase about the nature of the error!

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