{"record":{"id":"3918a268971b8245","repo":"apache/flink","slug":"properties-file-does-not-exist","errorCode":null,"errorMessage":"Properties file {} does not exist","messagePattern":"Properties file (.+?) does not exist","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/util/ParameterTool.java","lineNumber":117,"sourceCode":"     * @throws IOException If the file does not exist\n     * @see Properties\n     */\n    public static ParameterTool fromPropertiesFile(String path) throws IOException {\n        File propertiesFile = new File(path);\n        return fromPropertiesFile(propertiesFile);\n    }\n\n    /**\n     * Returns {@link ParameterTool} for the given {@link Properties} file.\n     *\n     * @param file File object to the properties file\n     * @return A {@link ParameterTool}\n     * @throws IOException If the file does not exist\n     * @see Properties\n     */\n    public static ParameterTool fromPropertiesFile(File file) throws IOException {\n        if (!file.exists()) {\n            throw new FileNotFoundException(\n                    \"Properties file \" + file.getAbsolutePath() + \" does not exist\");\n        }\n        try (FileInputStream fis = new FileInputStream(file)) {\n            return fromPropertiesFile(fis);\n        }\n    }\n\n    /**\n     * Returns {@link ParameterTool} for the given InputStream from {@link Properties} file.\n     *\n     * @param inputStream InputStream from the properties file\n     * @return A {@link ParameterTool}\n     * @throws IOException If the file does not exist\n     * @see Properties\n     */\n    public static ParameterTool fromPropertiesFile(InputStream inputStream) throws IOException {\n        Properties props = new Properties();\n        props.load(inputStream);","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/util/ParameterTool.java#L99-L135","documentation":"ParameterTool.fromPropertiesFile(File) checks file.exists() first and throws FileNotFoundException with the absolute path when the properties file is missing, before attempting to open it. The absolute path in the message disambiguates relative-path issues (cwd-dependent resolution). The IOException signature also covers read failures afterwards.","triggerScenarios":"Calling fromPropertiesFile(new File(path)) where path is wrong, relative to a different working directory, or the file is not yet created (ordering issue in setup code).","commonSituations":"Running the jar from a different directory than assumed; file packaged under resources but addressed as a filesystem path; path built from a config key that was not set (defaults like null/\"\" resolving to a bogus location).","solutions":["Check the absolute path in the message — usually the cwd assumption is wrong.","Use an absolute path, or resolve against a known base (user.dir, an app home property).","For classpath resources, load via getClass().getClassLoader().getResourceAsStream(...) and use fromPropertiesFile(InputStream) instead.","Create/default the file before reading if it is expected to be generated."],"exampleFix":"// before\nParameterTool p = ParameterTool.fromPropertiesFile(new File(\"conf/job.properties\"));\n\n// after\ntry (InputStream in = getClass().getClassLoader().getResourceAsStream(\"job.properties\")) {\n    ParameterTool p = ParameterTool.fromPropertiesFile(in);\n}","handlingStrategy":"validation","validationCode":"File f = new File(path);\nif (!f.isFile()) { throw new FileNotFoundException(\"config not found at \" + f.getAbsolutePath() + \" (cwd=\" + System.getProperty(\"user.dir\") + \")\"); }","typeGuard":null,"tryCatchPattern":"catch (FileNotFoundException e) { try classpath fallback: InputStream in = loader.getResourceAsStream(basename); if (in != null) return ParameterTool.fromPropertiesFile(in); throw e; }","preventionTips":["Resolve config paths against an explicit base directory.","Prefer classpath resources for read-only defaults."],"tags":["configuration","file-io","classpath","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}