{"record":{"id":"464e0628de1bbf50","repo":"apache/druid","slug":"a-local-input-source-accepts-only-one-of-s-or-s","errorCode":null,"errorMessage":"A local input source accepts only one of %s or %s","messagePattern":"A local input source accepts only one of (.+?) or (.+?)","errorType":"validation","errorClass":"IAE","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/catalog/model/table/LocalInputSourceDefn.java","lineNumber":102,"sourceCode":"    final boolean hasFiles = !CollectionUtils.isNullOrEmpty(CatalogUtils.safeGet(sourceMap, FILES_FIELD, List.class));\n    final boolean hasFilter = !Strings.isNullOrEmpty(CatalogUtils.getString(sourceMap, FILTER_FIELD));\n\n    if (!hasBaseDir && !hasFiles) {\n      throw new IAE(\n          \"A local input source requires one property of %s or %s\",\n          BASE_DIR_FIELD,\n          FILES_FIELD\n      );\n    }\n    if (!hasBaseDir && hasFilter) {\n      throw new IAE(\n          \"If a local input source sets property %s, it must also set property %s\",\n          FILTER_FIELD,\n          BASE_DIR_FIELD\n      );\n    }\n    if (hasBaseDir && hasFiles) {\n      throw new IAE(\n          \"A local input source accepts only one of %s or %s\",\n          BASE_DIR_FIELD,\n          FILES_FIELD\n      );\n    }\n    super.validate(table);\n  }\n\n  @Override\n  protected List<ParameterDefn> adHocTableFnParameters()\n  {\n    return Arrays.asList(\n        new Parameter(BASE_DIR_PARAMETER, ParameterType.VARCHAR, true),\n        FILTER_PARAM_DEFN,\n        FILES_PARAM_DEFN\n    );\n  }\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/catalog/model/table/LocalInputSourceDefn.java#L84-L120","documentation":"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.","triggerScenarios":"Validating a local input source whose inputSourceMap contains a baseDir field and also a non-empty files list.","commonSituations":"Merging two example configs; a template that emits both keys when variables are set; incremental edits that added files without removing baseDir.","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"],"exampleFix":"// before\n{\"type\":\"local\",\"baseDir\":\"/data\",\"files\":[\"/data/a.csv\"]}\n// after\n{\"type\":\"local\",\"baseDir\":\"/data\"}","handlingStrategy":"validation","validationCode":"if (src.containsKey(\"baseDir\")\n    && src.get(\"files\") != null && !((List<?>) src.get(\"files\")).isEmpty()) {\n  throw new IllegalArgumentException(\"local source accepts baseDir or files, not both\");\n}","typeGuard":null,"tryCatchPattern":"try { defn.validate(table); } catch (IAE e) { if (e.getMessage().contains(\"accepts only one of\")) { /* remove files or baseDir */ } else { throw e; } }","preventionTips":["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"],"tags":["local","input-source","validation","mutually-exclusive"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}