apache/kafka · error · IllegalStateException
The provider has not been configured yet.
Error message
The provider has not been configured yet.
What it means
Thrown as IllegalStateException (not ConfigException) by FileConfigProvider.get(path) when the volatile allowedPaths field is null, meaning configure(Map) was never invoked. Like DirectoryConfigProvider, FileConfigProvider requires configure() to initialise AllowedPaths before get(); the standard ConfigTransformer lifecycle calls configure() once per provider, so a null allowedPaths indicates the lifecycle was bypassed.
Source
Thrown at clients/src/main/java/org/apache/kafka/common/config/provider/FileConfigProvider.java:64
public static final String ALLOWED_PATHS_CONFIG = "allowed.paths";
public static final String ALLOWED_PATHS_DOC = "A comma separated list of paths that this config provider is " +
"allowed to access. If not set, all paths are allowed.";
private volatile AllowedPaths allowedPaths;
public void configure(Map<String, ?> configs) {
allowedPaths = new AllowedPaths((String) configs.getOrDefault(ALLOWED_PATHS_CONFIG, null));
}
/**
* Retrieves the data at the given Properties file.
*
* @param path the file where the data resides
* @return the configuration data
*/
public ConfigData get(String path) {
if (allowedPaths == null) {
throw new IllegalStateException("The provider has not been configured yet.");
}
Map<String, String> data = new HashMap<>();
if (path == null || path.isEmpty()) {
return new ConfigData(data);
}
Path filePath = allowedPaths.parseUntrustedPath(path);
if (filePath == null) {
log.warn("The path {} is not allowed to be accessed", path);
return new ConfigData(data);
}
try (Reader reader = reader(filePath)) {
Properties properties = new Properties();
properties.load(reader);
Enumeration<Object> keys = properties.keys();
while (keys.hasMoreElements()) {View on GitHub (pinned to c31c9215e1)
Solutions
- Call provider.configure(configs) before any get(); configs may be Map.of() when allowed.paths is unused.
- Obtain FileConfigProvider through ConfigTransformer so configure() runs automatically.
- In tests, call fileConfigProvider.configure(Map.of()) in @BeforeEach.
Example fix
// before
FileConfigProvider p = new FileConfigProvider();
ConfigData d = p.get("/etc/secrets.properties");
// after
FileConfigProvider p = new FileConfigProvider();
p.configure(Map.of());
ConfigData d = p.get("/etc/secrets.properties"); Defensive patterns
Strategy: validation
Validate before calling
// Enforce configure() before get(): FileConfigProvider provider = new FileConfigProvider(); provider.configure(configs); // MUST run first; sets the volatile AllowedPaths // Only now: ConfigData data = provider.get(path);
Try / catch
try {
provider.get(path);
} catch (IllegalStateException e) {
if (e.getMessage() != null && e.getMessage().contains("not been configured yet")) {
provider.configure(configs);
provider.get(path); // single retry after explicit configure
} else { throw e; }
} Prevention
- Always call configure() immediately after constructing FileConfigProvider; do not defer or skip.
- Use a factory method that returns an already-configured provider so the unconfigured state is unreachable.
- If integrating via Kafka's ConfigTransformer, rely on its built-in configure step rather than instantiating providers directly.
When it happens
Trigger: Calling FileConfigProvider.get(path) before provider.configure(configs). Common in unit tests or custom code that instantiates FileConfigProvider directly and skips configure().
Common situations: Manually constructing FileConfigProvider in application code or a test and forgetting configure({}). Reusing a closed provider instance. A custom integration that wires providers outside Kafka's ConfigTransformer / Herder.
Related errors
- The provider has not been configured yet.
- NetworkClient is no longer active, state is {state}
- Client was shutdown before response was read
- Failed to construct kafka consumer
- The timeout cannot be negative.
AI-assisted analysis of apache/kafka@c31c9215e1 (2026-08-03).
Data as JSON: /data/errors/bd02f0753f0c1615.json.
Report an issue: GitHub.