{"record":{"id":"cbc496b690d89519","repo":"apache/flink","slug":"file-path-was-not-specified-in-input-format-or-con","errorCode":null,"errorMessage":"File path was not specified in input format or configuration.","messagePattern":"File path was not specified in input format or configuration\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java","lineNumber":405,"sourceCode":"\n    // --------------------------------------------------------------------------------------------\n    //  Pre-flight: Configuration, Splits, Sampling\n    // --------------------------------------------------------------------------------------------\n\n    /**\n     * Configures the file input format by reading the file path from the configuration.\n     *\n     * @see\n     *     org.apache.flink.api.common.io.InputFormat#configure(org.apache.flink.configuration.Configuration)\n     */\n    @Override\n    public void configure(Configuration parameters) {\n\n        if (getFilePaths().length == 0) {\n            // file path was not specified yet. Try to set it from the parameters.\n            String filePath = parameters.getString(FILE_PARAMETER_KEY, null);\n            if (filePath == null) {\n                throw new IllegalArgumentException(\n                        \"File path was not specified in input format or configuration.\");\n            } else {\n                setFilePath(filePath);\n            }\n        }\n    }\n\n    /**\n     * Obtains basic file statistics containing only file size. If the input is a directory, then\n     * the size is the sum of all contained files.\n     *\n     * @see\n     *     org.apache.flink.api.common.io.InputFormat#getStatistics(org.apache.flink.api.common.io.statistics.BaseStatistics)\n     */\n    @Override\n    public FileBaseStatistics getStatistics(BaseStatistics cachedStats) throws IOException {\n\n        final FileBaseStatistics cachedFileStats =","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/api/common/io/FileInputFormat.java#L387-L423","documentation":"FileInputFormat.configure(parameters) is called by the runtime before splits are created. If no file path was set on the format directly (getFilePaths().length == 0), it looks for the path under the FILE_PARAMETER_KEY in the Configuration. If that is also absent (null), the format cannot proceed and throws IllegalArgumentException — reading requires at least one input path.","triggerScenarios":"Submitting a job whose FileInputFormat subclass had neither setFilePath/setFilePaths called nor a value set under the configuration key 'flink.input.file.path' (FILE_PARAMETER_KEY). Common when building a format from a generic factory that forgot to set the path.","commonSituations":"Programmatic job assembly where the path was set on a different (wrong) format instance; configuration-driven jobs where the path key is missing from the submitted config; refactoring that moved setFilePath behind a conditional that evaluated false.","solutions":["Call format.setFilePath(...) before submitting the job.","If using config-based paths, set the value under FILE_PARAMETER_KEY in the Configuration passed to configure().","Add a startup assertion that getFilePaths().length > 0 after format configuration."],"exampleFix":"// before\nFileInputFormat<MyType> format = new MyFormat();\nenv.readFile(format, null); // no path set -> configure() throws\n\n// after\nFileInputFormat<MyType> format = new MyFormat();\nformat.setFilePath(\"hdfs:///data/input\");\nenv.readFile(format, \"hdfs:///data/input\");","handlingStrategy":"validation","validationCode":"// After configuring the format, assert a path is present before submission.\nif (format.getFilePaths().length == 0) {\n    throw new IllegalStateException(\"FileInputFormat has no input path configured\");\n}\n// or set it from configuration:\nConfiguration cfg = new Configuration();\ncfg.setString(FileInputFormat.FILE_PARAMETER_KEY, \"hdfs:///data/input\");\nformat.configure(cfg);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call setFilePath during format construction.","If config-driven, set the value under FILE_PARAMETER_KEY before configure().","Add a submission-time assertion that getFilePaths().length > 0."],"tags":["input-format","file-path","configuration","lifecycle","illegal-argument"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}