Async HTTP -- response "getErrorJson" exception, but "getErrorData" shows JSON?

Seeing some odd behavior in the response handlers of async http methods. Using the following code:

def handleResponse(resp, data) {
    if (resp.hasError()) {
        def respError = ''
        try {
            respError = resp.getErrorJson()
        } catch (Exception e) {
            log.debug(e)
        }
        log.error(respError)
    }
}

I see the following exception logged: java.lang.Exception: No response data exists for async request

If I change from getErrorJson() to getErrorData(), the same request logs a JSON error:

{
  "error": {
    "code": 404,
    "message": "The provided ID does not match any albums.",
    "status": "NOT_FOUND"
  }
}

Help? Am I using the method wrong?

404 Not found. It would look like the JSON endpoint is invalid.
Try checking out your request in something like postman.

Agree there is a problem with the request - so I get an error. My question is aimed at why getErrorJson() throws an exception, when getErrorData() shows a JSON response body?

Just guessing, but are you specifying a content type for either your request or response when you run the async HTTP method (assuming you aren't using the dedicated JSON method already)?

Using asynchttpPost, with contentType: 'application/json' in the params

What is the status code from the response (getStatus())?

404 -- to be clear, at this point I'm expecting an error, and trying to understand the error parsing/handling. I can, of course, parse the JSON manually using JsonSlurper -- but I don't think I should have to...

Yep, I agree. Smells like a bug to me. It's valid JSON and an actual error status value (not like 2xx because of something quirky with the server response).