{"record":{"id":"e5956f4eb8d057b2","repo":"apache/flink","slug":"the-configuration-directory-was-not-specified-ple","errorCode":null,"errorMessage":"The configuration directory was not specified. Please specify the directory containing the configuration file through the '{}' environment variable.","messagePattern":"The configuration directory was not specified\\. Please specify the directory containing the configuration file through the '(.+?)' environment variable\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java","lineNumber":1388,"sourceCode":"        String location = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);\n\n        if (location != null) {\n            if (new File(location).exists()) {\n                return location;\n            } else {\n                throw new RuntimeException(\n                        \"The configuration directory '\"\n                                + location\n                                + \"', specified in the '\"\n                                + ConfigConstants.ENV_FLINK_CONF_DIR\n                                + \"' environment variable, does not exist.\");\n            }\n        } else if (new File(CONFIG_DIRECTORY_FALLBACK_1).exists()) {\n            location = CONFIG_DIRECTORY_FALLBACK_1;\n        } else if (new File(CONFIG_DIRECTORY_FALLBACK_2).exists()) {\n            location = CONFIG_DIRECTORY_FALLBACK_2;\n        } else {\n            throw new RuntimeException(\n                    \"The configuration directory was not specified. \"\n                            + \"Please specify the directory containing the configuration file through the '\"\n                            + ConfigConstants.ENV_FLINK_CONF_DIR\n                            + \"' environment variable.\");\n        }\n        return location;\n    }\n\n    /**\n     * Writes the given job manager address to the associated configuration object.\n     *\n     * @param address Address to write to the configuration\n     * @param config The configuration to write to\n     */\n    static void setJobManagerAddressInConfig(Configuration config, InetSocketAddress address) {\n        config.set(JobManagerOptions.ADDRESS, address.getHostString());\n        config.set(JobManagerOptions.PORT, address.getPort());\n        config.set(RestOptions.ADDRESS, address.getHostString());","sourceCodeStart":1370,"sourceCodeEnd":1406,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L1370-L1406","documentation":"Thrown by CliFrontend.getConfigurationDirectoryFromEnv when FLINK_CONF_DIR is not set AND neither of the two fallback configuration directories (CONFIG_DIRECTORY_FALLBACK_1 and CONFIG_DIRECTORY_FALLBACK_2, typically the conf/ directory relative to the Flink installation root) exists on the filesystem. Flink cannot start without knowing where to load flink-conf.yaml from. It is a RuntimeException thrown at startup.","triggerScenarios":"Running the flink CLI from a working directory where neither fallback path resolves; running from a partial Flink installation that has binaries but no conf/ directory; extracting only a subset of the distribution archive.","commonSituations":"Custom or stripped-down Flink installations missing the conf/ directory; running flink from a JAR-only classpath without the full distribution layout; containers built from minimal base images that excluded the conf directory.","solutions":["Set FLINK_CONF_DIR to the directory containing flink-conf.yaml","Ensure the Flink distribution is fully extracted with its conf/ directory intact","If running from a custom install, create a conf directory with at minimum a flink-conf.yaml file and point FLINK_CONF_DIR at it"],"exampleFix":"# before (no FLINK_CONF_DIR, no fallback found)\nflink run ...\n\n# after\nexport FLINK_CONF_DIR=/path/to/flink/conf\nflink run ...","handlingStrategy":"validation","validationCode":"String confDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);\nif (confDir == null) {\n    File fallback1 = new File(\"conf\"); // CONFIG_DIRECTORY_FALLBACK_1\n    File fallback2 = new File(\"../conf\"); // CONFIG_DIRECTORY_FALLBACK_2\n    if (!fallback1.exists() && !fallback2.exists()) {\n        throw new IllegalStateException(\n            \"No Flink config directory found. Set FLINK_CONF_DIR or extract the full distribution.\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set FLINK_CONF_DIR explicitly in production deployments","Use the full Flink distribution, not a stripped subset","Verify the conf/ directory contains at minimum flink-conf.yaml"],"tags":["cli","configuration","environment","startup"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}