# Attempting to generate cert, getting "UnicodeError: encoding with 'idna' codec failed"

**URL:** <https://community.letsencrypt.org/t/attempting-to-generate-cert-getting-unicodeerror-encoding-with-idna-codec-failed/61675>\
**Category:** Help\
**Created:** [May 11, 2018, 4:55pm UTC](https://community.letsencrypt.org/t/attempting-to-generate-cert-getting-unicodeerror-encoding-with-idna-codec-failed/61675 "2018-05-11T16:55:14Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![schoen](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/schoen/32/79_2.png) [@schoen](https://community.letsencrypt.org/u/schoen)\
**Post date:** [May 11, 2018, 5:26pm UTC](https://community.letsencrypt.org/t/attempting-to-generate-cert-getting-unicodeerror-encoding-with-idna-codec-failed/61675/4 "2018-05-11T17:26:17Z")

</div>

Thanks!

So, there are some Internet standards that say that the longest allowable label in a DNS name is 63 bytes. Your hostname `ruby-rails-s-1vcpu-1gb-sfo2-01-1525916611287-s-2vcpu-4gb-sfo2-01` is 64 bytes.

> **[Domain Name System | Domain name syntax](https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax)**
>
> The definitive descriptions of the rules for forming domain names appear in RFC 1035, RFC 1123, and RFC 2181.
> A domain name consists of one or more parts, technically called labels, that are conventionally concatenated, and delimited by dots, such as example.com.
> The right-most label conveys the top-level domain; for example, the domain name www.example.com belongs to the top-level domain com.
> The hierarchy of domains descends from right to left; each label to the left specifies a subdivision, ...

This wouldn’t directly bother Certbot (and wouldn’t bother Let’s Encrypt if you’re not literally trying to get a certificate covering that name), but it looks like some of Python 3’s internal logic crashes when asked to deal with hostnames that are longer than 63 bytes.

We’ll probably need to discuss whether we want to ask the Python developers to change this or whether we want to change the particular function that we call here. In the meantime, you could work around this by

- changing your system’s hostname so that it’s less than 64 bytes long
- running Certbot with Python 2 rather than Python 3 (maybe edit `/usr/bin/certbot` so that it starts with `#!/usr/bin/python2` instead of `#!/usr/bin/python3`?)
- editing the Certbot code on your system so that it uses some other value for your local host name here
- using a different Let’s Encrypt client rather than Certbot

Those are all the options that I can think of for the moment. 🙂

---

_[View the full topic](https://community.letsencrypt.org/t/attempting-to-generate-cert-getting-unicodeerror-encoding-with-idna-codec-failed/61675)._
