alibaba/spring-cloud-alibaba · critical · IllegalStateException
NacosConfigProperties not available
Error message
NacosConfigProperties not available
What it means
Thrown by NacosConfigDataLoader.doLoad when getBean(context, NacosConfigProperties.class) returns null after the NacosConfigManager was already resolved. NacosConfigProperties holds server-addr, namespace, group, timeout, etc.; its absence means the config-data environment was not bound, so the loader cannot determine where/with-what-options to pull config.
Source
Thrown at spring-cloud-alibaba-starters/spring-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/configdata/NacosConfigDataLoader.java:86
@Override
public @Nullable ConfigData load(ConfigDataLoaderContext context,
NacosConfigDataResource resource) {
return doLoad(context, resource);
}
public @Nullable ConfigData doLoad(ConfigDataLoaderContext context,
NacosConfigDataResource resource) {
try {
NacosConfigManager configManager = getBean(context, NacosConfigManager.class);
if (configManager == null) {
throw new IllegalStateException("NacosConfigManager not available");
}
ConfigService configService = configManager.getConfigService();
NacosConfigProperties properties = getBean(context,
NacosConfigProperties.class);
if (properties == null) {
throw new IllegalStateException("NacosConfigProperties not available");
}
NacosItemConfig config = resource.getConfig();
// pull config from nacos
List<PropertySource<?>> propertySources = pullConfig(configService,
config.getGroup(), config.getDataId(), config.getSuffix(),
properties.getTimeout(), properties.getNamespace());
NacosPropertySource propertySource = new NacosPropertySource(propertySources,
config.getGroup(), config.getDataId(), new Date(),
config.isRefreshEnabled());
propertySource.setSuffix(config.getSuffix());
NacosPropertySourceRepository.collectNacosPropertySource(propertySource);
return new ConfigData(Collections.singletonList(propertySource),
getOptions(context, resource));
}View on GitHub (pinned to 115d590110)
Solutions
- Provide spring.cloud.nacos.config.server-addr (and namespace/group/timeout as needed) so NacosConfigProperties binds.
- Do not exclude the autoconfiguration that registers NacosConfigProperties.
- Ensure the binder sees the properties (correct profile active, no typos in the property prefix).
- Align spring-cloud-alibaba version with the Spring Boot version used.
Example fix
# before spring.config.import: "nacos:app.yml" # no nacos config props # after spring.cloud.nacos.config.server-addr: 127.0.0.1:8848 spring.config.import: "nacos:app.yml"
Defensive patterns
Strategy: validation
Validate before calling
// Confirm NacosConfigProperties binds before relying on config-data import.
assert environment.getProperty("spring.cloud.nacos.config.server-addr") != null;
assert !environment.getPropertySources().stream().anyMatch(ps -> ps.getName().contains("nacos")) || environment.containsProperty("spring.cloud.nacos.config.server-addr"); Prevention
- Set spring.cloud.nacos.config.server-addr in every context that imports nacos: locations.
- Do not exclude the autoconfiguration that registers NacosConfigProperties.
- Keep spring-cloud-alibaba aligned with your Spring Boot version.
When it happens
Trigger: A nacos: config import is processed but NacosConfigProperties is not in the loader context — e.g., the properties bean was not created because spring.cloud.nacos.config.* is absent, the binder could not bind it, or an autoconfiguration that registers it is excluded.
Common situations: Forgetting spring.cloud.nacos.config.server-addr; disabling the Nacos config autoconfiguration; a profile that omits the nacos config block but still imports nacos: locations; version skew between spring-cloud-alibaba and the Boot config-data API.
Related errors
- NacosConfigManager not available
- NacosConfigProperties could not be loaded
- Binder not available in BootstrapContext
- dataId must be specified
- illegal URI: {uris}
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/792540d03e6b6bfe.
Report an issue: GitHub.