This is because it's getting HTML from the webserver error page. We should be able detect if the BE returned a 4xx or 5xx and make a nicer error text instead of trying to parse json