apache/flink · critical · RuntimeException
The configuration directory was not specified. Please specif
Error message
The configuration directory was not specified. Please specify the directory containing the configuration file through the '{}' environment variable. What it means
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.
Source
Thrown at flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java:1388
String location = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);
if (location != null) {
if (new File(location).exists()) {
return location;
} else {
throw new RuntimeException(
"The configuration directory '"
+ location
+ "', specified in the '"
+ ConfigConstants.ENV_FLINK_CONF_DIR
+ "' environment variable, does not exist.");
}
} else if (new File(CONFIG_DIRECTORY_FALLBACK_1).exists()) {
location = CONFIG_DIRECTORY_FALLBACK_1;
} else if (new File(CONFIG_DIRECTORY_FALLBACK_2).exists()) {
location = CONFIG_DIRECTORY_FALLBACK_2;
} else {
throw new RuntimeException(
"The configuration directory was not specified. "
+ "Please specify the directory containing the configuration file through the '"
+ ConfigConstants.ENV_FLINK_CONF_DIR
+ "' environment variable.");
}
return location;
}
/**
* Writes the given job manager address to the associated configuration object.
*
* @param address Address to write to the configuration
* @param config The configuration to write to
*/
static void setJobManagerAddressInConfig(Configuration config, InetSocketAddress address) {
config.set(JobManagerOptions.ADDRESS, address.getHostString());
config.set(JobManagerOptions.PORT, address.getPort());
config.set(RestOptions.ADDRESS, address.getHostString());View on GitHub (pinned to 2f3c205e92)
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
Example fix
# before (no FLINK_CONF_DIR, no fallback found) flink run ... # after export FLINK_CONF_DIR=/path/to/flink/conf flink run ...
Defensive patterns
Strategy: validation
Validate before calling
String confDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);
if (confDir == null) {
File fallback1 = new File("conf"); // CONFIG_DIRECTORY_FALLBACK_1
File fallback2 = new File("../conf"); // CONFIG_DIRECTORY_FALLBACK_2
if (!fallback1.exists() && !fallback2.exists()) {
throw new IllegalStateException(
"No Flink config directory found. Set FLINK_CONF_DIR or extract the full distribution.");
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The configuration directory '{}', specified in the '{}' envi
- No valid command-line found.
- The given configuration directory name '{}' ({}) does not de
- No cluster id was specified. Please specify a cluster to whi
- Bad syntax for classpath: {}
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/e5956f4eb8d057b2.
Report an issue: GitHub.