How to debug curl? gnutls_handshake failed -unexpected TLS packet (OpenSSL)

I had a blank line in my chain file and RootCA was not properly installed on the server that I run the openssl command from. Once fixed curl working fine.