apache/hadoop · critical · NoAuthWithCOSException
No COS Credential Providers
Error message
No COS Credential Providers
What it means
COSCredentialsProviderList is the refcounted chain of COSCredentialsProvider objects used by the cosn connector. checkNotEmpty() throws NoAuthWithCOSException("No COS Credential Providers") when the chain contains zero providers — authentication was never configured, so any credential lookup fails fast. This is a configuration error surfaced the moment the filesystem tries to authenticate.
Source
Thrown at hadoop-cloud-storage-project/hadoop-cos/src/main/java/org/apache/hadoop/fs/cosn/auth/COSCredentialsProviderList.java:75
public COSCredentialsProviderList() {
}
public COSCredentialsProviderList(
Collection<COSCredentialsProvider> providers) {
this.providers.addAll(providers);
}
public void add(COSCredentialsProvider provider) {
this.providers.add(provider);
}
public int getRefCount() {
return this.refCount.get();
}
public void checkNotEmpty() {
if (this.providers.isEmpty()) {
throw new NoAuthWithCOSException(NO_COS_CREDENTIAL_PROVIDERS);
}
}
public COSCredentialsProviderList share() {
Preconditions.checkState(!this.closed(), "Provider list is closed");
this.refCount.incrementAndGet();
return this;
}
public boolean closed() {
return this.isClosed.get();
}
@Override
public COSCredentials getCredentials() {
if (this.closed()) {
throw new NoAuthWithCOSException(CREDENTIALS_REQUESTED_WHEN_CLOSED);
}View on GitHub (pinned to 2add963021)
Solutions
- Set fs.cosn.credentials.provider in core-site.xml to a valid chain, e.g. org.apache.hadoop.fs.cosn.auth.SimpleCosCredentialsProvider (and/or EnvironmentVariableCredentialsProvider, CvmRoleCredentialsProvider on CVM)
- Provide the corresponding secrets: fs.cosn.userinfo.secretId / fs.cosn.userinfo.secretKey for the simple provider, or COS_SECRETID/COS_SECRETKEY env vars
- Verify provider class names against the hadoop-cos version in use (package org.apache.hadoop.fs.cosn.auth)
Example fix
// before // core-site.xml has no cosn credential config // -> NoAuthWithCOSException: No COS Credential Providers // after <property> <name>fs.cosn.credentials.provider</name> <value>org.apache.hadoop.fs.cosn.auth.SimpleCosCredentialsProvider</value> </property> <property> <name>fs.cosn.userinfo.secretId</name><value>...</value> </property> <property> <name>fs.cosn.userinfo.secretKey</name><value>...</value> </property>
Defensive patterns
Strategy: validation
Validate before calling
// Fail fast at startup instead of at first authenticated call
Configuration conf = new Configuration();
String chain = conf.get("fs.cosn.credentials.provider");
if (chain == null || chain.trim().isEmpty()) {
throw new IllegalArgumentException("fs.cosn.credentials.provider must be configured");
} Try / catch
try {
fs.initialize(uri, conf);
} catch (NoAuthWithCOSException e) {
if (String.valueOf(e.getMessage()).contains("No COS Credential Providers")) {
// configuration error, not transient — fix fs.cosn.credentials.provider
throw new IllegalStateException("cosn credentials not configured", e);
}
throw e;
} Prevention
- Always set fs.cosn.credentials.provider plus the matching secret sources in core-site.xml
- Add a startup config check so jobs fail before launch, not mid-run
- Validate provider class names against the hadoop-cos version in use
When it happens
Trigger: Initializing a CosNFileSystem with fs.cosn.credentials.provider unset/empty, or configured with class names that all failed to load, leaving the provider list empty. checkNotEmpty() runs at the start of getCredentials(), so the first authenticated SDK call triggers it.
Common situations: core-site.xml missing the fs.cosn.credentials.provider property; a typo in a provider class name so instantiation of every listed provider fails; constructing the provider list programmatically and forgetting to add() before use.
Related errors
- No COS Credentials provided by %s
- Credentials requested after provider list was closed
- SimpleAWSCredentialsProvider: No AWS credentials in the Hado
- {component}: Invalid AWS credentials in {credentials} requir
- dump not supported
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/5856ecdd4c0fd11b.
Report an issue: GitHub.