{"record":{"id":"792540d03e6b6bfe","repo":"alibaba/spring-cloud-alibaba","slug":"nacosconfigproperties-not-available","errorCode":null,"errorMessage":"NacosConfigProperties not available","messagePattern":"NacosConfigProperties not available","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"spring-cloud-alibaba-starters/spring-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/configdata/NacosConfigDataLoader.java","lineNumber":86,"sourceCode":"\n\t@Override\n\tpublic @Nullable ConfigData load(ConfigDataLoaderContext context,\n\t\t\tNacosConfigDataResource resource) {\n\t\treturn doLoad(context, resource);\n\t}\n\n\tpublic @Nullable ConfigData doLoad(ConfigDataLoaderContext context,\n\t\t\tNacosConfigDataResource resource) {\n\t\ttry {\n\t\t\tNacosConfigManager configManager = getBean(context, NacosConfigManager.class);\n\t\t\tif (configManager == null) {\n\t\t\t\tthrow new IllegalStateException(\"NacosConfigManager not available\");\n\t\t\t}\n\t\t\tConfigService configService = configManager.getConfigService();\n\t\t\tNacosConfigProperties properties = getBean(context,\n\t\t\t\t\tNacosConfigProperties.class);\n\t\t\tif (properties == null) {\n\t\t\t\tthrow new IllegalStateException(\"NacosConfigProperties not available\");\n\t\t\t}\n\n\t\t\tNacosItemConfig config = resource.getConfig();\n\t\t\t// pull config from nacos\n\t\t\tList<PropertySource<?>> propertySources = pullConfig(configService,\n\t\t\t\t\tconfig.getGroup(), config.getDataId(), config.getSuffix(),\n\t\t\t\t\tproperties.getTimeout(), properties.getNamespace());\n\n\t\t\tNacosPropertySource propertySource = new NacosPropertySource(propertySources,\n\t\t\t\t\tconfig.getGroup(), config.getDataId(), new Date(),\n\t\t\t\t\tconfig.isRefreshEnabled());\n\t\t\tpropertySource.setSuffix(config.getSuffix());\n\n\t\t\tNacosPropertySourceRepository.collectNacosPropertySource(propertySource);\n\n\t\t\treturn new ConfigData(Collections.singletonList(propertySource),\n\t\t\t\t\tgetOptions(context, resource));\n\t\t}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/alibaba/spring-cloud-alibaba/blob/115d5901102009492e05d5ec18c3f79cad4077d0/spring-cloud-alibaba-starters/spring-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/configdata/NacosConfigDataLoader.java#L68-L104","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nspring.config.import: \"nacos:app.yml\"   # no nacos config props\n# after\nspring.cloud.nacos.config.server-addr: 127.0.0.1:8848\nspring.config.import: \"nacos:app.yml\"","handlingStrategy":"validation","validationCode":"// Confirm NacosConfigProperties binds before relying on config-data import.\nassert environment.getProperty(\"spring.cloud.nacos.config.server-addr\") != null;\nassert !environment.getPropertySources().stream().anyMatch(ps -> ps.getName().contains(\"nacos\")) || environment.containsProperty(\"spring.cloud.nacos.config.server-addr\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["nacos","config-data","spring-boot","config-properties","startup"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}