apache/druid · error · IAE
A local input source accepts only one of %s or %s
Error message
A local input source accepts only one of %s or %s
What it means
LocalInputSourceDefn.validate permits specifying files by baseDir (optionally with filter) or by an explicit files list, but not both, since the two mechanisms are redundant and conflicting. Thrown as IllegalArgumentException when both baseDir and a non-empty files list are present.
Source
Thrown at server/src/main/java/org/apache/druid/catalog/model/table/LocalInputSourceDefn.java:102
final boolean hasFiles = !CollectionUtils.isNullOrEmpty(CatalogUtils.safeGet(sourceMap, FILES_FIELD, List.class));
final boolean hasFilter = !Strings.isNullOrEmpty(CatalogUtils.getString(sourceMap, FILTER_FIELD));
if (!hasBaseDir && !hasFiles) {
throw new IAE(
"A local input source requires one property of %s or %s",
BASE_DIR_FIELD,
FILES_FIELD
);
}
if (!hasBaseDir && hasFilter) {
throw new IAE(
"If a local input source sets property %s, it must also set property %s",
FILTER_FIELD,
BASE_DIR_FIELD
);
}
if (hasBaseDir && hasFiles) {
throw new IAE(
"A local input source accepts only one of %s or %s",
BASE_DIR_FIELD,
FILES_FIELD
);
}
super.validate(table);
}
@Override
protected List<ParameterDefn> adHocTableFnParameters()
{
return Arrays.asList(
new Parameter(BASE_DIR_PARAMETER, ParameterType.VARCHAR, true),
FILTER_PARAM_DEFN,
FILES_PARAM_DEFN
);
}
View on GitHub (pinned to 9b90983fd2)
Solutions
- Remove the files list and rely on baseDir (plus optional filter)
- Or remove baseDir/filter and keep only the explicit files list
- Re-validate after keeping exactly one discovery mechanism
Example fix
// before
{"type":"local","baseDir":"/data","files":["/data/a.csv"]}
// after
{"type":"local","baseDir":"/data"} Defensive patterns
Strategy: validation
Validate before calling
if (src.containsKey("baseDir")
&& src.get("files") != null && !((List<?>) src.get("files")).isEmpty()) {
throw new IllegalArgumentException("local source accepts baseDir or files, not both");
} Try / catch
try { defn.validate(table); } catch (IAE e) { if (e.getMessage().contains("accepts only one of")) { /* remove files or baseDir */ } else { throw e; } } Prevention
- Choose one discovery style per local source and stick to it
- When migrating between styles, delete the old key
- Lint local source maps for the two-key conflict before validation
When it happens
Trigger: Validating a local input source whose inputSourceMap contains a baseDir field and also a non-empty files list.
Common situations: Merging two example configs; a template that emits both keys when variables are set; incremental edits that added files without removing baseDir.
Related errors
- A local input source requires one property of %s or %s
- If a local input source sets property %s, it must also set p
- '%s' must be a string or an array of strings
- Either uri xor uriPrefix required
- Cannot define both uri and fileRegex
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/464e0628de1bbf50.
Report an issue: GitHub.