apache/druid · error · IAE

A local input source requires one parameter of

Error message

A local input source requires one parameter of %s or %s

What it means

The Druid catalog's local input source table function requires either a baseDir parameter or a files parameter when converting table-function arguments into an input-source JSON map. If both are absent there is no way to identify which local files to read, so convertArgsToSourceMap throws this IAE. It is a user-facing validation error for incomplete table function calls.

Solutions

  1. Add a files parameter listing the local files to read, e.g. TABLE('local', FILES => ARRAY['/path/a.json'])
  2. Add a baseDir parameter (optionally with filter) instead of files
  3. Verify argument names match baseDir/files/filter exactly — misspelled names are silently ignored

Example fix

// before
SELECT * FROM TABLE(EXTERN('local'))
// after
SELECT * FROM TABLE(EXTERN('local', FILES => ARRAY['/data/events.json']))
Defensive patterns

Strategy: validation

Validate before calling

// Java
boolean hasBaseDir = args.get("baseDir") != null && !((String) args.get("baseDir")).isEmpty();
Object files = args.get("files");
boolean hasFiles = files instanceof List && !((List<?>) files).isEmpty();
if (!hasBaseDir && !hasFiles) throw new IllegalArgumentException("Provide baseDir or files");

Type guard

// Java
static boolean hasNonEmpty(Object v) { return v instanceof String && !((String) v).isEmpty(); }
static boolean hasItems(Object v) { return v instanceof List && !((List<?>) v).isEmpty(); }

Try / catch

try { tableFn.convert(args); } catch (IAE e) { if (e.getMessage().contains("requires one parameter")) { /* prompt user for baseDir/files */ } else throw e; }

Prevention

When it happens

Trigger: Calling the local-input-source table function (e.g. in SQL TABLE(...) syntax) with neither baseDir nor files supplied, or passing null/empty-string baseDir and an empty or missing files array.

Common situations: Writing TABLE('local', ...) in SQL and forgetting required arguments; building table-function args programmatically and leaving files empty; copy-pasting a call and deleting the files argument.

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/005d29088ca31b9e. Report an issue: GitHub.

Appendix: source

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

        new Parameter(BASE_DIR_PARAMETER, ParameterType.VARCHAR, true),
        FILTER_PARAM_DEFN,
        FILES_PARAM_DEFN
    );
  }

  @Override
  protected void convertArgsToSourceMap(Map<String, Object> jsonMap, Map<String, Object> args)
  {
    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));

View on GitHub (pinned to 9b90983fd2)