The errors found during this can be several, depending on setup. Going to the www.domain.com while you only have a certificate with domain.com, will make your browser complain about issues with the certificate.
Same with the other way around.
The certificate needs to contain both the domains used in the
VirtualHost in Apache or
Server Block in nginx.
letsencrypt -d domain.com -d www.domain.com
Note that the above command will attempt to automatically add certificate to whichever webserver you are using. Use
letsencrypt --help for further help.