{"record":{"id":"140cad5482c84987","repo":"alibaba/spring-cloud-alibaba","slug":"nacosconfigproperties-could-not-be-loaded","errorCode":null,"errorMessage":"NacosConfigProperties could not be loaded","messagePattern":"NacosConfigProperties could not be loaded","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/NacosConfigDataLocationResolver.java","lineNumber":152,"sourceCode":"\t\treturn PREFIX;\n\t}\n\n\t@Override\n\tpublic List<NacosConfigDataResource> resolve(\n\t\t\tConfigDataLocationResolverContext context, ConfigDataLocation location)\n\t\t\tthrows ConfigDataLocationNotFoundException,\n\t\t\tConfigDataResourceNotFoundException {\n\t\treturn Collections.emptyList();\n\t}\n\n\t@Override\n\tpublic List<NacosConfigDataResource> resolveProfileSpecific(\n\t\t\tConfigDataLocationResolverContext resolverContext,\n\t\t\tConfigDataLocation location, Profiles profiles)\n\t\t\tthrows ConfigDataLocationNotFoundException {\n\t\tNacosConfigProperties properties = loadProperties(resolverContext);\n\t\tif (properties == null) {\n\t\t\tthrow new IllegalStateException(\"NacosConfigProperties could not be loaded\");\n\t\t}\n\n\t\tConfigurableBootstrapContext bootstrapContext = resolverContext\n\t\t\t\t.getBootstrapContext();\n\n\t\tbootstrapContext.registerIfAbsent(NacosConfigProperties.class,\n\t\t\t\tBootstrapRegistry.InstanceSupplier.of(properties));\n\n\t\tregisterConfigManager(properties, bootstrapContext, resolverContext);\n\n\t\treturn loadConfigDataResources(location, profiles, properties);\n\t}\n\n\tprivate List<NacosConfigDataResource> loadConfigDataResources(\n\t\t\tConfigDataLocation location, Profiles profiles,\n\t\t\tNacosConfigProperties properties) {\n\t\tList<NacosConfigDataResource> result = new ArrayList<>();\n\t\tURI uri = getUri(location, properties);","sourceCodeStart":134,"sourceCodeEnd":170,"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/NacosConfigDataLocationResolver.java#L134-L170","documentation":"Thrown by NacosConfigDataLocationResolver.resolveProfileSpecific when loadProperties(resolverContext) returns null. loadProperties binds NacosConfigProperties from the environment; a null result means the properties could not be bound at the profile-specific resolution stage, so the resolver cannot build the config-data resource list. This is the profile-specific counterpart to the 'NacosConfigProperties not available' loader error.","triggerScenarios":"spring.config.import has nacos: entries and a profile-specific import is being resolved, but spring.cloud.nacos.config.* is missing/unbindable so NacosConfigProperties cannot be constructed.","commonSituations":"Profile (e.g., application-dev.yml) imports nacos: but the nacos config block lives only in another profile or is omitted; property typos in spring.cloud.nacos.config; excluding the Nacos config autoconfiguration; version skew.","solutions":["Ensure spring.cloud.nacos.config.server-addr (and namespace/group) is bound in every profile that imports nacos: locations.","Move the nacos config block to a shared location (application.yml) or duplicate it into profile-specific files.","Do not exclude the Nacos config autoconfiguration when importing nacos: locations.","Verify the active profile actually contains the nacos config properties."],"exampleFix":"# before: only the default profile has nacos props, but dev imports nacos:\n# application-dev.yml\nspring.config.import: \"nacos:app-dev.yml\"\n# after\nspring.cloud.nacos.config.server-addr: 127.0.0.1:8848\nspring.config.import: \"nacos:app-dev.yml\"","handlingStrategy":"validation","validationCode":"// Ensure the active profile binds nacos config props before profile-specific import resolution.\nassert environment.getProperty(\"spring.cloud.nacos.config.server-addr\") != null : \"nacos config props required\";","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Put nacos config props in application.yml (shared) or replicate into each profile.","Do not import nacos: locations from a profile that lacks nacos config props.","Do not exclude the Nacos config autoconfiguration."],"tags":["nacos","config-data","spring-boot","profiles","config-properties"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}