apache/druid · error · IAE

A local input source can set parameter

Error message

A local input source can set parameter %s or %s, but not both.

What it means

When the local input source table function receives both baseDir and files, the Druid LocalInputSource itself cannot represent both at once, so the catalog resolves the combination by converting files to paths relative to baseDir. That workaround is only safe when no filter is also given, since a filter plus an explicit file list is contradictory. Supplying baseDir + files + filter therefore throws this IAE.

Solutions

  1. Remove the filter parameter when files is provided
  2. Remove files and keep baseDir + filter to select files by pattern
  3. If files need a base directory prefix, pass absolute paths in files without baseDir

Example fix

// before
TABLE('local', BASE_DIR => '/data', FILES => ARRAY['a.json'], FILTER => '*.json')
// after
TABLE('local', BASE_DIR => '/data', FILES => ARRAY['a.json'])
Defensive patterns

Strategy: validation

Validate before calling

// Java
if (hasParam(args,"baseDir") && hasParam(args,"files") && hasParam(args,"filter"))
  throw new IllegalArgumentException("Use files OR filter with baseDir, not both");

Try / catch

try { fn.call(args); } catch (IAE e) { if (e.getMessage().contains("but not both")) { args.remove("filter"); fn.call(args); } else throw e; }

Prevention

When it happens

Trigger: Calling the local input source table function with all three parameters: baseDir, files, and filter all non-empty.

Common situations: Users copying a template that had baseDir+filter and adding a files argument; tools generating arguments that always emit filter; misunderstanding that files already selects files so a filter is redundant.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/01d419f76c0e9176. Report an issue: GitHub.

Appendix: source

Thrown at server/src/main/java/org/apache/druid/catalog/model/table/LocalInputSourceDefn.java:141

  {
    jsonMap.put(InputSource.TYPE_PROPERTY, LocalInputSource.TYPE_KEY);

    final String baseDirParam = CatalogUtils.getString(args, BASE_DIR_PARAMETER);
    final List<String> filesParam = CatalogUtils.getStringArray(args, FILES_PARAMETER);
    final String filterParam = CatalogUtils.getString(args, FILTER_PARAMETER);
    final boolean hasBaseDir = !Strings.isNullOrEmpty(baseDirParam);
    final boolean hasFiles = !CollectionUtils.isNullOrEmpty(filesParam);
    final boolean hasFilter = !Strings.isNullOrEmpty(filterParam);
    if (!hasBaseDir && !hasFiles) {
      throw new IAE(
          "A local input source requires one parameter of %s or %s",
          BASE_DIR_PARAMETER,
          FILES_PARAMETER
      );
    }
    if (hasBaseDir && hasFiles) {
      if (hasFilter) {
        throw new IAE(
            "A local input source can set parameter %s or %s, but not both.",
            FILES_PARAMETER,
            FILTER_PARAMETER
        );
      }
      // Special workaround: if the user provides a base dir, and files, convert
      // the files to be absolute paths relative to the base dir. Then, remove
      // the baseDir, since the Druid input source does not allow both a baseDir
      // and a list of files.
      jsonMap.put(FILES_FIELD, absolutePath(baseDirParam, filesParam));
      return;
    }
    if (!hasBaseDir && !Strings.isNullOrEmpty(filterParam)) {
      throw new IAE(
          "If a local input source sets parameter %s, it must also set parameter %s",
          FILTER_PARAMETER,
          BASE_DIR_PARAMETER
      );

View on GitHub (pinned to 9b90983fd2)