apache/dolphinscheduler · error · IllegalArgumentException
At least one path should be provided
Error message
At least one path should be provided
What it means
FileUtils.concatFilePath joins path segments into a single filesystem path using the platform separator. It throws IllegalArgumentException("At least one path should be provided") when invoked with a zero-length varargs array, since there is nothing to concatenate.
Source
Thrown at dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java:294
Files.createDirectories(path);
} else {
Path parent = path.getParent();
if (parent != null && !parent.toFile().exists()) {
createDirectoryWithPermission(parent, permissions);
}
try {
Files.createDirectory(path);
Files.setPosixFilePermissions(path, permissions);
} catch (FileAlreadyExistsException fileAlreadyExistsException) {
log.error("The directory: {} already exists", path);
}
}
}
public static String concatFilePath(String... paths) {
if (paths.length == 0) {
throw new IllegalArgumentException("At least one path should be provided");
}
StringBuilder finalPath = new StringBuilder(paths[0]);
if (StringUtils.isEmpty(finalPath)) {
throw new IllegalArgumentException("The path should not be empty");
}
String separator = File.separator;
for (int i = 1; i < paths.length; i++) {
String path = paths[i];
if (StringUtils.isEmpty(path)) {
throw new IllegalArgumentException("The path should not be empty");
}
if (finalPath.toString().endsWith(separator) && path.startsWith(separator)) {
finalPath.append(path.substring(separator.length()));
continue;
}
if (!finalPath.toString().endsWith(separator) && !path.startsWith(separator)) {
finalPath.append(separator).append(path);
continue;View on GitHub (pinned to 02eac45a1b)
Solutions
- Guard the caller: if paths.length == 0, supply a default base path or skip the operation
- Validate the source list is non-empty before spreading it into the varargs call
- If an empty path list is legitimate, return a sensible default (e.g. the working directory) instead of calling concatFilePath
- Check the upstream config/env value feeding the list — an unset key usually renders as an empty array
Example fix
// before
String full = FileUtils.concatFilePath(parts.toArray(new String[0])); // IAE when parts is empty
// after
if (parts.isEmpty()) {
throw new IllegalArgumentException("No path segments configured");
}
String full = FileUtils.concatFilePath(parts.toArray(new String[0])); Defensive patterns
Strategy: validation
Validate before calling
if (paths == null || paths.length == 0) {
throw new IllegalArgumentException("concatFilePath requires at least one path segment");
} Try / catch
try {
String path = FileUtils.concatFilePath(segments);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("At least one path")) {
log.error("No path segments provided; check the configured path list");
} else throw e;
} Prevention
- Guard varargs spreads from possibly-empty collections before calling
- Validate env/config-driven path lists are non-empty at startup
- Provide a default base directory when the segment list is empty
- Prefer explicit overloads (base + child) over open varargs when callers may pass empty data
When it happens
Trigger: Calling FileUtils.concatFilePath() with no arguments — typically by spreading an empty array/list (concatFilePath(paths.toArray(new String[0])) where paths is empty) rather than a literal empty call.
Common situations: Building a resource path from a config list or split() result that turned out empty; passing an environment-derived path list where the env var is unset; filter/map chains that removed all candidate paths before concatenation.
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
- The path is not a file: ${fileAbsolutePath}
- remote.logging.google.cloud.storage.bucket.name is blank
- remote.logging.oss.bucket.name is empty
- data: %s should be a validate data string - yyyy-MM-dd HH:mm
- The date must not be null
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/fb6718535cc1cfde.
Report an issue: GitHub.