apache/druid · error · IllegalArgumentException

At least one of baseDir or files should be specified

Error message

At least one of baseDir or files should be specified

What it means

LocalInputSource requires at least one source of input: a baseDir directory (combined with a filter) or an explicit list of files. Constructing or deserializing it with neither baseDir nor a non-empty files collection throws this IllegalArgumentException immediately in the constructor.

Source

Thrown at processing/src/main/java/org/apache/druid/data/input/impl/LocalInputSource.java:95

  private final String filter;
  private final List<File> files;
  private final SystemFields systemFields;

  @JsonCreator
  public LocalInputSource(
      @JsonProperty("baseDir") @Nullable File baseDir,
      @JsonProperty("filter") @Nullable String filter,
      @JsonProperty("files") @Nullable List<File> files,
      @JsonProperty(SYSTEM_FIELDS_PROPERTY) @Nullable SystemFields systemFields
  )
  {
    this.baseDir = baseDir;
    this.filter = baseDir != null ? Preconditions.checkNotNull(filter, "filter") : filter;
    this.files = files == null ? Collections.emptyList() : files;
    this.systemFields = systemFields == null ? SystemFields.none() : systemFields;

    if (baseDir == null && CollectionUtils.isNullOrEmpty(files)) {
      throw new IAE("At least one of baseDir or files should be specified");
    }
  }

  @JsonIgnore
  @Nonnull
  @Override
  public Set<String> getTypes()
  {
    return Collections.singleton(TYPE_KEY);
  }

  public LocalInputSource(File baseDir, String filter)
  {
    this(baseDir, filter, null, SystemFields.none());
  }

  @Nullable
  public File getBaseDir()

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Add baseDir to the local inputSource spec
  2. Or add the files array with explicit file paths
  3. If using code, ensure either baseDir or a non-empty files list is passed to the constructor

Example fix

// before
"inputSource": {"type": "local"}
// after
"inputSource": {"type": "local", "baseDir": "/data", "filter": "*.json"}
Defensive patterns

Strategy: validation

Validate before calling

if (spec.getBaseDir() == null && (spec.getFiles() == null || spec.getFiles().isEmpty())) { throw new IllegalArgumentException("Provide baseDir or files"); }

Type guard

boolean isValidLocalInputSource(LocalInputSource s) { return s.getBaseDir() != null || !s.getFiles().isEmpty(); }

Prevention

When it happens

Trigger: Creating new LocalInputSource(null, null, ...) in code, or submitting an ingestion spec where the local inputSource object omits both baseDir and files (or provides an empty files array).

Common situations: Hand-edited ingestion specs where baseDir was removed, programmatic spec builders that pass null placeholders, template specs with unfilled fields.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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