{"record":{"id":"1ba3ba13d9959484","repo":"apache/flink","slug":"at-least-one-file-path-must-be-specified","errorCode":null,"errorMessage":"At least one file path must be specified.","messagePattern":"At least one file path must be specified\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java","lineNumber":311,"sourceCode":"     *\n     * @param filePaths The paths of the files to read.\n     */\n    public void setFilePaths(String... filePaths) {\n        Path[] paths = new Path[filePaths.length];\n        for (int i = 0; i < paths.length; i++) {\n            paths[i] = new Path(filePaths[i]);\n        }\n        setFilePaths(paths);\n    }\n\n    /**\n     * Sets multiple paths of files to be read.\n     *\n     * @param filePaths The paths of the files to read.\n     */\n    public void setFilePaths(Path... filePaths) {\n        if (filePaths.length < 1) {\n            throw new IllegalArgumentException(\"At least one file path must be specified.\");\n        }\n        this.filePaths = filePaths;\n    }\n\n    public long getMinSplitSize() {\n        return minSplitSize;\n    }\n\n    public void setMinSplitSize(long minSplitSize) {\n        if (minSplitSize < 0) {\n            throw new IllegalArgumentException(\"The minimum split size cannot be negative.\");\n        }\n\n        this.minSplitSize = minSplitSize;\n    }\n\n    public int getNumSplits() {\n        return numSplits;","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L293-L329","documentation":"setFilePaths(Path...) (and the String varargs overload that feeds it) requires at least one path. An empty varargs array means no input is configured, which the format cannot use to read data, so it rejects with IllegalArgumentException rather than silently doing nothing.","triggerScenarios":"Calling format.setFilePaths() with no arguments, or setFilePaths(new Path[0]); passing an empty list/array converted to a varargs call.","commonSituations":"Dynamically building the path list from a filter that matched nothing; spreading an empty collection into the varargs call; refactoring that produced an empty array.","solutions":["Ensure at least one path is passed, e.g. format.setFilePaths(path1, path2).","Guard the call: only invoke setFilePaths when the path collection is non-empty.","If no input is genuinely available, skip creating/configuring the source rather than passing an empty array."],"exampleFix":"// before\nPath[] paths = discoverInputs().toArray(new Path[0]); // empty\nformat.setFilePaths(paths); // throws\n\n// after\nList<Path> discovered = discoverInputs();\nif (!discovered.isEmpty()) {\n    format.setFilePaths(discovered.toArray(new Path[0]));\n} else {\n    throw new IllegalStateException(\"No input files discovered\");\n}","handlingStrategy":"validation","validationCode":"List<Path> paths = discoverInputs();\nif (paths.isEmpty()) {\n    throw new IllegalStateException(\"No input files discovered\");\n}\nformat.setFilePaths(paths.toArray(new Path[0]));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard dynamic path lists for emptiness before setFilePaths.","Fail the job explicitly when no inputs are found rather than passing an empty array.","Unit-test the discovery logic against an empty directory."],"tags":["input-format","file-path","validation","illegal-argument"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}