quarkusio/quarkus · error · IllegalStateException
No configuration is available
Error message
No configuration is available
What it means
SmallRyeConfig's ConfigSource-proxy get() is substituted in native mode to return the static config captured by QuarkusConfigFactory; if no config has been set (config factory not initialized), an IllegalStateException "No configuration is available" is thrown. This indicates ConfigProvider.getConfig() was called before Quarkus initialized the configuration subsystem.
Source
Thrown at core/runtime/src/main/java/io/quarkus/runtime/graal/ConfigurationSubstitutions.java:28
import io.smallrye.config.SmallRyeConfigProviderResolver;
@TargetClass(SmallRyeConfigProviderResolver.class)
final class Target_io_smallrye_config_SmallRyeConfigProviderResolver {
@Substitute
public Config getConfig() {
return get();
}
@Substitute
public Config getConfig(ClassLoader classLoader) {
return get();
}
@Substitute
public SmallRyeConfig get() {
SmallRyeConfig config = Target_io_quarkus_runtime_configuration_QuarkusConfigFactory.config;
if (config == null) {
throw new IllegalStateException("No configuration is available");
}
return config;
}
@Substitute
public SmallRyeConfig get(ClassLoader classLoader) {
return get();
}
@Substitute
public void registerConfig(org.eclipse.microprofile.config.Config config, ClassLoader classLoader) {
// no op
}
@Substitute
public void releaseConfig(org.eclipse.microprofile.config.Config config) {
// no op
}View on GitHub (pinned to e1c734241f)
Solutions
- Move config access into runtime code that runs after application startup (e.g. CDI injection of org.eclipse.microprofile.config.Config)
- Use @Inject Config / @ConfigProperty instead of static ConfigProvider.getConfig()
- If code must run early, ensure QuarkusConfigFactory.setConfig has been invoked first (e.g. by starting the application)
- In tests, use @QuarkusTest or initialize the config factory manually before access
Example fix
// before
static final String URL = ConfigProvider.getConfig().getValue("app.url", String.class);
// after
String url;
@Inject
public MyBean(Config config) { this.url = config.getValue("app.url", String.class); } Defensive patterns
Strategy: try-catch
Validate before calling
// only access config after startup; check availability first
SmallRyeConfig cfg = QuarkusConfigFactory.getConfigUnsafe(); // or track an 'app started' flag
if (!appStarted) throw new IllegalStateException("Access config only at runtime"); Try / catch
try { config = ConfigProvider.getConfig(); } catch (IllegalStateException e) { if (e.getMessage().contains("No configuration is available")) { config = loadFallbackConfig(); } else throw e; } Prevention
- Prefer @Inject Config or @ConfigProperty over static ConfigProvider.getConfig()
- Never read config from static initializers
- Use @QuarkusTest so config is initialized in tests
When it happens
Trigger: Calling ConfigProvider.getConfig() (directly or via SmallRyeConfig APIs) from static initializers, before the application started, or after shutdown — anywhere QuarkusConfigFactory.config has not been populated.
Common situations: Static fields initialized at class-load time calling config; tests using ConfigProvider without launching Quarkus; using config in a build-time or pre-init context; running outside a Quarkus runtime (e.g. plain unit test of runtime code).
Related errors
- Unsupported media type or encoding format: ${contentType}
- Invalid privateKey format
- service interface name cannot be null or blank
- service interface descriptor file path cannot be null
- Could not read class path resources having path '${resourceP
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/0e0d75300fea44dc.
Report an issue: GitHub.