apache/druid · error · IllegalArgumentException
Provide either the %s property, or one of the S3 input sourc
Error message
Provide either the %s property, or one of the S3 input source fields %s, %s or %s, but not both.
What it means
The catalog S3 table supports two mutually exclusive addressing styles: a bucket property on the table, or S3 input-source fields (uris/prefixes/objects) inside the inputSourceMap. Druid throws this IllegalArgumentException when both styles are supplied, since it cannot decide which targeting to use. The bucket style gets translated into a synthetic uris entry internally.
Source
Thrown at extensions-core/s3-extensions/src/main/java/org/apache/druid/catalog/model/table/S3InputSourceDefn.java:155
final boolean hasColumns = !CollectionUtils.isNullOrEmpty(table.resolvedTable().spec().columns());
if (hasFormat && !hasColumns) {
throw new IAE(
"An external S3 table with a format must also provide the corresponding columns"
);
}
// The user can either provide a bucket, or can provide one of the valid items.
final String bucket = table.resolvedTable().stringProperty(BUCKET_PROPERTY);
final boolean hasBucket = bucket != null;
final Map<String, Object> sourceMap = table.inputSourceMap;
final boolean hasUris = sourceMap.containsKey(URIS_FIELD);
final boolean hasPrefix = sourceMap.containsKey(PREFIXES_FIELD);
final boolean hasObjects = sourceMap.containsKey(OBJECTS_FIELD);
final boolean hasGlob = sourceMap.containsKey(OBJECT_GLOB_FIELD);
if (hasBucket) {
if (hasUris || hasPrefix || hasObjects) {
throw new IAE(
"Provide either the %s property, or one of the S3 input source fields %s, %s or %s, but not both.",
BUCKET_PROPERTY,
URIS_FIELD,
PREFIXES_FIELD,
OBJECTS_FIELD
);
}
if (hasGlob) {
throw new IAE(
"The %s property cannot be provided when the %s property is set",
OBJECT_GLOB_FIELD,
BUCKET_PROPERTY
);
}
// Patch in a dummy URI so that validation of the rest of the fields
// will pass.
sourceMap.put(URIS_FIELD, Collections.singletonList(bucket));View on GitHub (pinned to 9b90983fd2)
Solutions
- Remove the bucket property and keep only the uris/prefixes/objects fields in the inputSource
- Or remove the uris/prefixes/objects fields and specify only the bucket property
- Check whether a template or migration tool duplicated location settings and keep one
Example fix
// before
{"bucket": "my-bucket", "inputSource": {"type": "s3", "uris": ["s3://my-bucket/data/"]}}
// after
{"inputSource": {"type": "s3", "uris": ["s3://my-bucket/data/"]}} Defensive patterns
Strategy: validation
Validate before calling
boolean hasBucket = spec.stringProperty("bucket") != null;
Map<String, Object> src = spec.inputSourceMap;
if (hasBucket && (src.containsKey("uris") || src.containsKey("prefixes") || src.containsKey("objects"))) {
throw new IllegalArgumentException("bucket and uris/prefixes/objects are mutually exclusive");
} Type guard
boolean usesOnlyOneAddressing(String bucket, Map<String, Object> src) {
boolean hasListFields = src.containsKey("uris") || src.containsKey("prefixes") || src.containsKey("objects");
return !(bucket != null && hasListFields);
} Try / catch
try {
tableDefn.validate(table);
} catch (IllegalArgumentException e) {
// strip uris/prefixes/objects when bucket is set, then retry
} Prevention
- Pick one addressing style per table: bucket OR uris/prefixes/objects
- Never merge raw S3InputSource JSON fragments into catalog table specs without review
- Write a pre-submit validator mirroring the catalog's rules
When it happens
Trigger: Calling validate() on a ResolvedExternalTable where the bucket property is set on the table spec AND the inputSourceMap contains any of the keys uris, prefixes, or objects.
Common situations: Combining an example table spec that uses bucket with an inputSource copied from a raw S3InputSource JSON that uses uris or prefixes; template-generated specs where both mechanisms were filled in.
Related errors
- The %s property cannot be provided when the %s property is s
- An external S3 table with a format must also provide the cor
- S3 external table defines the %s property. The table functio
- S3 accepts only one of %s, %s or %s
- S3 requires one of %s, %s or %s
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/aaf2cb5ef2bb756d.
Report an issue: GitHub.