I spent hours trying to solve this bug and the solution was so simple. 
My rpcpassword in my bitcoin.conf file contained a '#' character.

Prevent this from happening, by outputting this an error or warning when users run bitcoind.

Right now, you can have a # character as a password and it will work on the command line but will fail when you JSON-RPC.
{
    
    
    
    
#ifdef WIN32
    
    return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin";
#else
    fs::path pathRet;
    char* pszHome = getenv("HOME");
    if (pszHome == nullptr || strlen(pszHome) == 0)
        pathRet = fs::path("/");
    else
        pathRet = fs::path(pszHome);
#ifdef MAC_OSX
    
    return pathRet / "Library/Application Support/Bitcoin";
#else
    
    return pathRet / ".bitcoin";
#endif
#endif
}
static fs::path g_blocks_path_cached;
static fs::path g_blocks_path_cache_net_specific;
static fs::path pathCached;
static fs::path pathCachedNetSpecific;
static CCriticalSection csPathCached;
const fs::path &GetBlocksDir(bool fNetSpecific)