apache/druid · error · IAE

If a local input source sets parameter

Error message

If a local input source sets parameter %s, it must also set parameter %s

What it means

A filter parameter for the local input source is interpreted relative to a base directory; without baseDir the filter pattern has no root to search. When the table function call supplies filter but no baseDir (and no files), convertArgsToSourceMap rejects the combination with this IAE.

Solutions

  1. Add a baseDir parameter alongside filter
  2. Use files with explicit paths instead of filter
  3. If filtering the current working directory is intended, set baseDir explicitly to that directory

Example fix

// before
TABLE('local', FILTER => '*.json')
// after
TABLE('local', BASE_DIR => '/data', FILTER => '*.json')
Defensive patterns

Strategy: validation

Validate before calling

// Java
boolean hasFilter = hasNonEmpty(args.get("filter"));
boolean hasBaseDir = hasNonEmpty(args.get("baseDir"));
if (hasFilter && !hasBaseDir) throw new IllegalArgumentException("filter requires baseDir");

Try / catch

try { fn.call(args); } catch (IAE e) { if (e.getMessage().startsWith("If a local input source sets parameter")) { /* add baseDir or drop filter */ } else throw e; }

Prevention

When it happens

Trigger: Calling the local input source table function with filter set but neither baseDir nor files provided (files+filter is rejected earlier at error 1891 if baseDir is also present).

Common situations: Assuming filter applies to the server's working directory; switching from baseDir+files+filter to just filter after seeing error 1891 and dropping baseDir too.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

      );
    }
    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
      );
    }
    if (hasBaseDir) {
      jsonMap.put(BASE_DIR_FIELD, baseDirParam);
    }
    if (hasFiles) {
      jsonMap.put(FILES_FIELD, filesParam);
    }
    if (filterParam != null) {
      jsonMap.put(FILTER_FIELD, filterParam);
    }
  }

  private List<String> absolutePath(String baseDirPath, List<String> files)
  {

View on GitHub (pinned to 9b90983fd2)