apache/hadoop · error · SASTokenProviderException

Invalid auth type: %s is being used, expecting SAS.

Error message

Invalid auth type: %s is being used, expecting SAS.

What it means

Error "Invalid auth type: %s is being used, expecting SAS." thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java:1627

  /**
   * Returns the SASTokenProvider implementation to be used to generate SAS token.<br>
   * Users can choose between a custom implementation of {@link SASTokenProvider}
   * or an in house implementation {@link FixedSASTokenProvider}.<br>
   * For Custom implementation "fs.azure.sas.token.provider.type" needs to be provided.<br>
   * For Fixed SAS Token use "fs.azure.sas.fixed.token" needs to be provided.<br>
   * In case both are provided, Preference will be given to Custom implementation.<br>
   * Avoid using a custom tokenProvider implementation just to read the configured
   * fixed token, as this could create confusion. Also,implementing the SASTokenProvider
   * requires relying on the raw configurations. It is more stable to depend on
   * the AbfsConfiguration with which a filesystem is initialized, and eliminate
   * chances of dynamic modifications and spurious situations.<br>
   * @return sasTokenProvider object based on configurations provided
   * @throws AzureBlobFileSystemException if SAS token provider initialization fails
   */
  public SASTokenProvider getSASTokenProvider() throws AzureBlobFileSystemException {
    AuthType authType = getEnum(FS_AZURE_ACCOUNT_AUTH_TYPE_PROPERTY_NAME, AuthType.SharedKey);
    if (authType != AuthType.SAS) {
      throw new SASTokenProviderException(String.format(
          "Invalid auth type: %s is being used, expecting SAS.", authType));
    }

    try {
      Class<? extends SASTokenProvider> customSasTokenProviderImplementation =
          getTokenProviderClass(authType, FS_AZURE_SAS_TOKEN_PROVIDER_TYPE,
              null, SASTokenProvider.class);
      String configuredFixedToken = this.getTrimmedPasswordString(FS_AZURE_SAS_FIXED_TOKEN, EMPTY_STRING);

      if (customSasTokenProviderImplementation == null && configuredFixedToken.isEmpty()) {
        throw new SASTokenProviderException(String.format(
            "At least one of the \"%s\" and \"%s\" must be set.",
            FS_AZURE_SAS_TOKEN_PROVIDER_TYPE, FS_AZURE_SAS_FIXED_TOKEN));
      }

      // Prefer Custom SASTokenProvider Implementation if configured.
      if (customSasTokenProviderImplementation != null) {
        LOG.trace("Using Custom SASTokenProvider implementation because it is given precedence when it is set.");

View on GitHub (pinned to 2add963021)

Solutions

  1. Set fs.azure.account.auth.type to SAS for this configuration, or use the matching auth type settings.

When it happens

Trigger: Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java:1627 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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