{"record":{"id":"fb6718535cc1cfde","repo":"apache/dolphinscheduler","slug":"at-least-one-path-should-be-provided","errorCode":null,"errorMessage":"At least one path should be provided","messagePattern":"At least one path should be provided","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java","lineNumber":294,"sourceCode":"            Files.createDirectories(path);\n        } else {\n            Path parent = path.getParent();\n            if (parent != null && !parent.toFile().exists()) {\n                createDirectoryWithPermission(parent, permissions);\n            }\n\n            try {\n                Files.createDirectory(path);\n                Files.setPosixFilePermissions(path, permissions);\n            } catch (FileAlreadyExistsException fileAlreadyExistsException) {\n                log.error(\"The directory: {} already exists\", path);\n            }\n        }\n    }\n\n    public static String concatFilePath(String... paths) {\n        if (paths.length == 0) {\n            throw new IllegalArgumentException(\"At least one path should be provided\");\n        }\n        StringBuilder finalPath = new StringBuilder(paths[0]);\n        if (StringUtils.isEmpty(finalPath)) {\n            throw new IllegalArgumentException(\"The path should not be empty\");\n        }\n        String separator = File.separator;\n        for (int i = 1; i < paths.length; i++) {\n            String path = paths[i];\n            if (StringUtils.isEmpty(path)) {\n                throw new IllegalArgumentException(\"The path should not be empty\");\n            }\n            if (finalPath.toString().endsWith(separator) && path.startsWith(separator)) {\n                finalPath.append(path.substring(separator.length()));\n                continue;\n            }\n            if (!finalPath.toString().endsWith(separator) && !path.startsWith(separator)) {\n                finalPath.append(separator).append(path);\n                continue;","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/FileUtils.java#L276-L312","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nString full = FileUtils.concatFilePath(parts.toArray(new String[0])); // IAE when parts is empty\n\n// after\nif (parts.isEmpty()) {\n    throw new IllegalArgumentException(\"No path segments configured\");\n}\nString full = FileUtils.concatFilePath(parts.toArray(new String[0]));","handlingStrategy":"validation","validationCode":"if (paths == null || paths.length == 0) {\n    throw new IllegalArgumentException(\"concatFilePath requires at least one path segment\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    String path = FileUtils.concatFilePath(segments);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"At least one path\")) {\n        log.error(\"No path segments provided; check the configured path list\");\n    } else throw e;\n}","preventionTips":["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"],"tags":["file","path","illegal-argument","varargs"],"backgroundTag":"missing-required-argument","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}