apache/hadoop · error · UnexpectedResponseException

AADToken: HTTP connection to

Error message

AADToken: HTTP connection to {} failed for getting token from AzureAD. Unexpected response. Check configuration, URLs and proxy settings. proxies={}

What it means

Raised during an AAD token acquisition HTTP call that returned an unexpected status: the endpoint, proxy, or configuration is likely wrong (e.g. a sign-on page or proxy answered instead of the token endpoint). Includes response code, body excerpt and proxy settings for diagnosis.

Solutions

  1. Verify the AAD token endpoint URL, client id/secret, and proxy settings in the configuration.
  2. Check network connectivity and proxy configuration (proxies listed in the message).
  3. Inspect the HTTP response body with DEBUG logging for the AAD error detail.
Defensive patterns

Strategy: validation

When it happens

Trigger: The HTTP call to Azure AD for a token returns an unexpected status, commonly due to wrong credentials, wrong endpoint, or proxy interference.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/97fcefcd85b5f625. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/oauth2/AzureADAuthenticator.java:493

        String httpProxy = System.getProperty("http.proxy");
        String httpsProxy = System.getProperty("https.proxy");
        if (httpProxy != null || httpsProxy != null) {
          proxies = "http:" + httpProxy + "; https:" + httpsProxy;
        }
        String operation = "AADToken: HTTP connection to " + authEndpoint
            + " failed for getting token from AzureAD.";
        String logMessage = operation
                        + " HTTP response: " + httpResponseCode
                        + " " + conn.getResponseMessage()
                        + " Proxies: " + proxies
                        + (responseBody.isEmpty()
                          ? ""
                          : ("\nFirst 1K of Body: " + responseBody));
        LOG.debug(logMessage);
        if (httpResponseCode == HttpURLConnection.HTTP_OK) {
          // 200 is returned by some of the sign-on pages, but can also
          // come from proxies, utterly wrong URLs, etc.
          throw new UnexpectedResponseException(httpResponseCode,
              requestId,
              operation
                  + " Unexpected response."
                  + " Check configuration, URLs and proxy settings."
                  + " proxies=" + proxies,
              authEndpoint,
              responseContentType,
              responseBody);
        } else {
          // general HTTP error
          throw new HttpException(httpResponseCode,
              requestId,
              operation,
              authEndpoint,
              responseContentType,
              responseBody);
        }
      }

View on GitHub (pinned to 2add963021)