apache/hadoop · error · IllegalArgumentException

Invalid account key.

Error message

Invalid account key.

What it means

Error "Invalid account key." thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/SharedKeyCredentials.java:76

  private static final Pattern CRLF = Pattern.compile("\r\n", Pattern.LITERAL);
  private static final String HMAC_SHA256 = "HmacSHA256";
  /**
   * Stores a reference to the RFC1123 date/time pattern.
   */
  private static final String RFC1123_PATTERN = "EEE, dd MMM yyyy HH:mm:ss z";


  private String accountName;
  private byte[] accountKey;
  private Mac hmacSha256;

  public SharedKeyCredentials(final String accountName,
                              final String accountKey) {
    if (accountName == null || accountName.isEmpty()) {
      throw new IllegalArgumentException("Invalid account name.");
    }
    if (accountKey == null || accountKey.isEmpty()) {
      throw new IllegalArgumentException("Invalid account key.");
    }
    this.accountName = accountName;
    this.accountKey = Base64.decode(accountKey);
    initializeMac();
  }

  public void signRequest(AbfsHttpOperation connection, final long contentLength) throws UnsupportedEncodingException {

    String gmtTime = getGMTTime();
    connection.setRequestProperty(HttpHeaderConfigurations.X_MS_DATE, gmtTime);

    final String stringToSign = canonicalize(connection, accountName, contentLength);

    final String computedBase64Signature = computeHmac256(stringToSign);

    String signature = String.format("%s %s:%s", "SharedKey", accountName,
        computedBase64Signature);
    connection.setRequestProperty(HttpHeaderConfigurations.AUTHORIZATION,

View on GitHub (pinned to 2add963021)

Solutions

  1. Set fs.azure.account.key.<account> to the correct base64 storage account key.
  2. Check for truncation or extra whitespace in the configured key.

When it happens

Trigger: SharedKeyCredentials is constructed with a missing or invalid account key.

Common situations: See trigger scenarios.


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