{"record":{"id":"08d591074d88f6f8","repo":"apache/hadoop","slug":"unable-to-load-user-bound-sas-token-provider-class","errorCode":null,"errorMessage":"Unable to load user-bound SAS token provider class: {e}","messagePattern":"Unable to load user-bound SAS token provider class: (.+?)","errorType":"exception","errorClass":"SASTokenProviderException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java","lineNumber":1704,"sourceCode":"        throw new SASTokenProviderException(String.format(\n            \"\\\"%s\\\" must be set for user-bound SAS auth type.\",\n            FS_AZURE_SAS_TOKEN_PROVIDER_TYPE));\n      }\n\n        SASTokenProvider sasTokenProvider = ReflectionUtils.newInstance(\n            customSasTokenProviderImplementation, rawConfig);\n        if (sasTokenProvider == null) {\n          throw new SASTokenProviderException(String.format(\n              \"Failed to initialize %s\", customSasTokenProviderImplementation));\n        }\n        LOG.trace(\"Initializing {}\", customSasTokenProviderImplementation.getName());\n        sasTokenProvider.initialize(rawConfig, accountName);\n        LOG.trace(\"{} init complete\", customSasTokenProviderImplementation.getName());\n        return sasTokenProvider;\n    } catch (SASTokenProviderException e) {\n      throw e;\n    } catch (Exception e) {\n      throw new SASTokenProviderException(\n          \"Unable to load user-bound SAS token provider class: \" + e, e);\n    }\n  }\n\n  /**\n   * Returns both the AccessTokenProvider and the SASTokenProvider\n   * when auth type is UserboundSASWithOAuth.\n   *\n   * @return Object[] where:\n   *   [0] = AccessTokenProvider\n   *   [1] = SASTokenProvider\n   * @throws AzureBlobFileSystemException if provider initialization fails\n   */\n  public Object[] getUserBoundSASBothTokenProviders()\n      throws AzureBlobFileSystemException {\n    AuthType authType = getEnum(FS_AZURE_ACCOUNT_AUTH_TYPE_PROPERTY_NAME,\n        AuthType.SharedKey);\n    if (authType != AuthType.UserboundSASWithOAuth) {","sourceCodeStart":1686,"sourceCodeEnd":1722,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AbfsConfiguration.java#L1686-L1722","documentation":"Catch-all inside getUserBoundSASTokenProvider: any exception other than SASTokenProviderException thrown while resolving, instantiating, or initializing the user-bound SAS token provider is rethrown as SASTokenProviderException with 'Unable to load user-bound SAS token provider class: ' plus the cause. The original failure (ClassNotFoundException, IllegalAccessException/InstantiationException, or an error inside the provider's initialize(rawConfig, accountName)) is chained.","triggerScenarios":"fs.azure.sas.token.provider.type contains a typo or names a class missing from the driver/executor classpath (ClassNotFoundException); the provider class lacks an accessible no-arg constructor; or the provider's initialize() throws because its own required config keys are absent.","commonSituations":"Provider jar not shipped with the job (YARN containers, Spark executors); provider reads account-specific settings that were not propagated; provider compiled against an older hadoop-azure ABI; shaded jars that relocate the class away.","solutions":["Inspect e.getCause() — it carries the real error such as ClassNotFoundException or the provider's own exception from initialize().","Fix the class name in fs.azure.sas.token.provider.type and confirm the jar is on both driver and executor classpaths.","Ensure every config key the provider's initialize() needs is present in the job Configuration.","Rebuild the provider against the same Hadoop/hadoop-azure version the cluster runs."],"exampleFix":"// before\n<property><name>fs.azure.sas.token.provider.type</name><value>com.example.UserSASProvider</value></property>\n<!-- actual class lives at com.example.providers.UserSASProvider -->\n\n// after\n<property><name>fs.azure.sas.token.provider.type</name><value>com.example.providers.UserSASProvider</value></property>","handlingStrategy":"try-catch","validationCode":"Class<?> cls;\ntry {\n  cls = Class.forName(conf.get(\"fs.azure.sas.token.provider.type\"));\n} catch (ClassNotFoundException | NullPointerException e) {\n  throw new IOException(\"SAS token provider class not loadable: \" + e, e);\n}\nif (!SASTokenProvider.class.isAssignableFrom(cls)) {\n  throw new IOException(\"Provider does not implement SASTokenProvider: \" + cls);\n}","typeGuard":null,"tryCatchPattern":"try {\n  FileSystem fs = path.getFileSystem(conf);\n} catch (SASTokenProviderException e) {\n  Throwable cause = e.getCause(); // CNFE, IllegalAccess, or provider initialize() failure\n  LOG.error(\"User-bound SAS provider load failed: {}\", cause, e);\n  throw e;\n}","preventionTips":["Ship the provider jar to every driver/executor classpath.","Test provider initialize() with the production configuration in CI.","Pin the hadoop-azure version the provider is compiled against."],"tags":["azure","abfs","sas-token","classpath","extensions","classloading"],"backgroundTag":"provider-class-load-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}