An unexpected error occurred:

I’m trying to generate certificate for my domain with virtualmin.

I get this error:

… request failed : Web-based validation failed :

Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org An unexpected error occurred: TypeError: str returned non-string (type Error) Please see the logfiles in /var/log/letsencrypt for more details.

DNS-based validation failed :

Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator manual, Installer None Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org An unexpected error occurred: TypeError: str returned non-string (type Error) Please see the logfiles in /var/log/letsencrypt for more details.

Checking the log, nothing is clear for me.

2020-04-13 16:45:48,484:DEBUG:certbot._internal.main:certbot version: 1.3.0
2020-04-13 16:45:48,484:DEBUG:certbot._internal.main:Arguments: [’–manual’, ‘-d’, ‘domainexample.com’, ‘-d’, ‘www.sdomainexample.com’, ‘–preferred-challenges=dns’, ‘–manual-auth-hook’, ‘/etc/webmin/webmin/letsencrypt-dns.pl’, ‘–manual-cleanup-hook’, ‘/etc/webmin/webmin/letsencrypt-cleanup.pl’, ‘–duplicate’, ‘–force-renewal’, ‘–manual-public-ip-logging-ok’, ‘–non-interactive’, ‘–agree-tos’, ‘–config’, ‘/tmp/.webmin/379363_13631_3_letsencrypt.cgi’, ‘–rsa-key-size’, ‘2048’, ‘–cert-name’, ‘domainexample.com’]
2020-04-13 16:45:48,484:DEBUG:certbot._internal.main:Discovered plugins: PluginsRegistry(PluginEntryPoint#apache,PluginEntryPoint#manual,PluginEntryPoint#null,PluginEntryPoint#standalone,PluginEntryPoint#webroot)
2020-04-13 16:45:48,502:DEBUG:certbot._internal.log:Root logging level set at 20
2020-04-13 16:45:48,502:INFO:certbot._internal.log:Saving debug log to /var/log/letsencrypt/letsencrypt.log
2020-04-13 16:45:48,503:DEBUG:certbot._internal.plugins.selection:Requested authenticator manual and installer None
2020-04-13 16:45:48,504:DEBUG:certbot._internal.plugins.selection:Single candidate plugin: * manual
Description: Manual configuration or run your own shell scripts
Interfaces: IAuthenticator, IPlugin
Entry point: manual = certbot._internal.plugins.manual:Authenticator
Initialized: <certbot._internal.plugins.manual.Authenticator object at 0x7f855bcd8e90>
Prep: True
2020-04-13 16:45:48,504:DEBUG:certbot._internal.plugins.selection:Selected authenticator <certbot._internal.plugins.manual.Authenticator object at 0x7f855bcd8e90> and installer None
2020-04-13 16:45:48,504:INFO:certbot._internal.plugins.selection:Plugins selected: Authenticator manual, Installer None
2020-04-13 16:45:48,527:DEBUG:certbot._internal.main:Picked account: <Account(RegistrationResource(body=Registration(status=None, terms_of_service_agreed=None, agreement=None, only_return_existing=None, contact=(), key=None, external_account_binding=None), uri=u’https://acme-v02.api.letsencrypt.org/acme/acct/83051230’, new_authzr_uri=None, terms_of_service=None), eb9a6097073c529863052fb818b77443, Meta(creation_host=u’flagstone.ro’, creation_dt=datetime.datetime(2020, 4, 10, 15, 13, 17, tzinfo=)))>
2020-04-13 16:45:48,529:DEBUG:acme.client:Sending GET request to https://acme-v02.api.letsencrypt.org/directory.
2020-04-13 16:45:48,541:INFO:urllib3.connectionpool:Starting new HTTPS connection (1): acme-v02.api.letsencrypt.org
2020-04-13 16:45:48,573:DEBUG:certbot._internal.log:Exiting abnormally:
Traceback (most recent call last):
File “/bin/letsencrypt”, line 9, in
load_entry_point(‘certbot==1.3.0’, ‘console_scripts’, ‘certbot’)()
File “/usr/lib/python2.7/site-packages/certbot/main.py”, line 15, in main
return internal_main.main(cli_args)
File “/usr/lib/python2.7/site-packages/certbot/_internal/main.py”, line 1347, in main
return config.func(config, plugins)
File “/usr/lib/python2.7/site-packages/certbot/_internal/main.py”, line 1217, in certonly
le_client = _init_le_client(config, auth, installer)
File “/usr/lib/python2.7/site-packages/certbot/_internal/main.py”, line 610, in _init_le_client
return client.Client(config, acc, authenticator, installer, acme=acme)
File “/usr/lib/python2.7/site-packages/certbot/_internal/client.py”, line 257, in init
acme = acme_from_config_key(config, self.account.key, self.account.regr)
File “/usr/lib/python2.7/site-packages/certbot/_internal/client.py”, line 44, in acme_from_config_key
return acme_client.BackwardsCompatibleClientV2(net, key, config.server)
File “/usr/lib/python2.7/site-packages/acme/client.py”, line 808, in init
directory = messages.Directory.from_json(net.get(server).json())
File “/usr/lib/python2.7/site-packages/acme/client.py”, line 1141, in get
self._send_request(‘GET’, url, **kwargs), content_type=content_type)
File “/usr/lib/python2.7/site-packages/acme/client.py”, line 1091, in _send_request
response = self.session.request(method, url, *args, **kwargs)
File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 486, in request
resp = self.send(prep, **send_kwargs)
File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 598, in send
r = adapter.send(request, **kwargs)
File “/usr/lib/python2.7/site-packages/requests/adapters.py”, line 370, in send
timeout=timeout
File “/usr/lib/python2.7/site-packages/urllib3/connectionpool.py”, line 544, in urlopen
body=body, headers=headers)
File “/usr/lib/python2.7/site-packages/urllib3/connectionpool.py”, line 344, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
File “/usr/lib/python2.7/site-packages/urllib3/connectionpool.py”, line 314, in _raise_timeout
if ‘timed out’ in str(err) or ‘did not complete (read)’ in str(err): # Python 2.6
TypeError: str returned non-string (type Error)
2020-04-13 16:45:48,575:ERROR:certbot._internal.log:An unexpected error occurred:

Any clue?thx

1 Like

First, to solve this specific error, it seems you need to upgrade urllib3. (Or, potentially, requests, which can include its own copy of urllib3 – you’re currently using an independent urllib3, though.)

What OS are you on? If you’re lucky, there might be an update available. If there isn’t, it may be best to use certbot-auto (which installs Python dependencies separately in a virtual environment) or upgrade to a newer release of your OS, which might happen to package a newer requests or urllib3.

Second, this error may or may not be important: something went wrong, then this bug is in the urllib3 error handling. Fixing it may just reveal what the original error is and leave you to solve that. Instead, if you can somehow figure out what network problem is happening, you might be able to resolve or work around it and ignore the error handling bug.

(Edits: Expanded the post.)

1 Like

Well, is wired, because yesterday worked.

My OS is CentOS Linux 7.7.1908

1 Like

There might be some kind of coincidental, temporary problem with the Internet between you and the API.

1 Like

OK. I’ll wait and trying again later.

One more question, pls.
Before use let’s encrypt cert I was using a self-signed cert.
I requested an let’s encrypt cert… and it is still using old cert. I’ve deleted from /home/mydoimainname/ were was and still showing me that old one.

1 Like

Hi there. I came back after taking your advice “There might be some kind of coincidental, temporary problem with the Internet between you and the API.” and still does sending back the same error

Any other clues? Thx

1 Like

I also have this problem in CentOS 7.
In other server that it works, certbot --version shows 0.36. In the server that throws this error, certbot --version shows 1.3
It has been working without problems until some days ago… I don’t know really what the problem is, but I cannot add new certificates nor renew the existing ones.

As @viper_tkd says, any clue is welcome. I’ve upgraded all the upgradeable things… :frowning:
Thanks in advance

@rafaelo did you find the solution on this issue?

Not at all @viper_tkd. I’ve checked if there is an update for certbot, but it is not the case. It’s very frustrating… Do you have any new info?
Regards

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