After banging my head against this error for too long today and finding other threads where people were also struggling with it, I wanted to post the solution that worked for my situation in case it might be helpful to others.
This page pointed me in the right direction: https://docs.directadmin.com/webservices/ssl/troubleshooting-letsencrypt.html
However, both
	
		
 and 
	
	
	
		
 worked fine.
The problem turned out to be that letsencrypt.sh is hard-coded to use Google’s 8.8.8.8 nameserver, which had not updated to the new record for the domain (even though the TTL had passed). Editing letsencrypt.sh and changing
	
		
 to one I knew was correct fixed the problem.
				
			This page pointed me in the right direction: https://docs.directadmin.com/webservices/ssl/troubleshooting-letsencrypt.html
However, both
		Code:
	
	http://domain.com/.well-known/acme-challenge/test.txt
		Code:
	
	/usr/local/bin/curl -I -L -k -X GET http://domain.com/.well-known/acme-challenge/test.txtThe problem turned out to be that letsencrypt.sh is hard-coded to use Google’s 8.8.8.8 nameserver, which had not updated to the new record for the domain (even though the TTL had passed). Editing letsencrypt.sh and changing
		Code:
	
	DNS_SERVER 
 
		