{"record":{"id":"6c45cbdb9fb7b5d8","repo":"alibaba/spring-cloud-alibaba","slug":"nacosconfigmanager-not-available","errorCode":null,"errorMessage":"NacosConfigManager not available","messagePattern":"NacosConfigManager 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":80,"sourceCode":"\n\tprivate final Log log;\n\n\tpublic NacosConfigDataLoader(DeferredLogFactory logFactory) {\n\t\tthis.log = logFactory.getLog(getClass());\n\t}\n\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());","sourceCodeStart":62,"sourceCodeEnd":98,"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#L62-L98","documentation":"Thrown by NacosConfigDataLoader.doLoad during Spring Boot config-data import when getBean(context, NacosConfigManager.class) returns null. The NacosConfigManager bean is expected to be registered in the bootstrap context (NacosConfigDataLocationResolver.registerConfigManager registers it only when spring.config.import nacos entries exist). A null here means that registration did not happen before the loader tried to pull remote config.","triggerScenarios":"spring.config.import references nacos: URIs but the NacosConfigManager was not registered — e.g., the resolver's registerConfigManager was skipped because SPRING_CONFIG_IMPORT_PROPERTIES was empty, the bootstrap context was reset/replaced, or the autoconfiguration that registers the manager is disabled/excluded.","commonSituations":"Misconfigured spring.cloud.nacos.config / spring.config.import; excluding the Nacos config autoconfiguration while still importing nacos: locations; a Spring Boot version mismatch where the bootstrap-context registration ordering changed; a custom ConfigDataLocationResolver that bypasses registerConfigManager.","solutions":["Ensure spring.config.import includes a nacos: entry (e.g., spring.config.import=nacos:app.yml) AND spring.cloud.nacos.config.server-addr is set so the autoconfiguration registers NacosConfigManager.","Do not exclude NacosConfigAutoConfiguration / the relevant autoconfiguration classes when importing nacos: locations.","Match Spring Boot / spring-cloud-alibaba versions so the bootstrap-context registration runs before the loader.","Confirm no custom ConfigDataLocationResolver overrode registerConfigManager."],"exampleFix":"// application.yml\n# before (import without config props -> manager never registered)\nspring:\n  config:\n    import: \"nacos:app.yml\"\n# after\nspring:\n  cloud:\n    nacos:\n      config:\n        server-addr: 127.0.0.1:8848\n  config:\n    import: \"nacos:app.yml\"","handlingStrategy":"validation","validationCode":"// Before importing nacos: locations, ensure the manager will be registered: spring.config.import must be non-empty AND nacos config props set.\nassert environment.getProperty(\"spring.config.import\") != null;\nassert environment.getProperty(\"spring.cloud.nacos.config.server-addr\") != null;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair spring.config.import=nacos:... with spring.cloud.nacos.config.server-addr.","Do not exclude the Nacos config autoconfiguration when importing nacos: locations.","Match spring-cloud-alibaba version with your Spring Boot version."],"tags":["nacos","config-data","spring-boot","config-import","startup"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}