{"record":{"id":"d792bd69c72e9517","repo":"alibaba/Sentinel","slug":"could-not-locate-propertysource-and-the-fail-fast","errorCode":null,"errorMessage":"Could not locate PropertySource and the fail fast property is set, failing","messagePattern":"Could not locate PropertySource and the fail fast property is set, failing","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"sentinel-extension/sentinel-datasource-spring-cloud-config/src/main/java/com/alibaba/csp/sentinel/datasource/spring/cloud/config/SentinelRuleLocator.java","lineNumber":133,"sourceCode":"                                .getSource();\n                            composite.addPropertySource(\n                                new MapPropertySource(source.getName(), map));\n                        }\n                    }\n                    SentinelRuleStorage.setRulesSource(composite);\n                    return composite;\n                }\n            }\n        } catch (HttpServerErrorException e) {\n            error = e;\n            if (MediaType.APPLICATION_JSON.includes(e.getResponseHeaders().getContentType())) {\n                errorBody = e.getResponseBodyAsString();\n            }\n        } catch (Exception e) {\n            error = e;\n        }\n        if (properties.isFailFast()) {\n            throw new IllegalStateException(\n                \"Could not locate PropertySource and the fail fast property is set, failing\",\n                error);\n        }\n        RecordLog.warn(\"Could not locate PropertySource: \" + (errorBody == null\n            ? error == null ? \"label not found\" : error.getMessage()\n            : errorBody));\n        return null;\n\n    }\n\n    public org.springframework.core.env.PropertySource<?> refresh() {\n        return locate(environment);\n    }\n\n    private void log(Environment result) {\n\n        RecordLog.info(\"Located environment: name={}, profiles={}, label={}, version={}, state={}\",\n            result.getName(),","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-extension/sentinel-datasource-spring-cloud-config/src/main/java/com/alibaba/csp/sentinel/datasource/spring/cloud/config/SentinelRuleLocator.java#L115-L151","documentation":"Thrown by SentinelRuleLocator.locate() when fetching the remote environment from the Spring Cloud Config server failed (HTTP error, network error, or label not found) AND the client's fail-fast property is enabled. With fail-fast=true the locator rethrows the captured error wrapped in this IllegalStateException instead of just logging a warning and returning null.","triggerScenarios":"sentinel-rule-source-spring-cloud-config client configured with failFast=true, and the Config Server is down/unreachable, returns 5xx, or the requested label/branch/profile does not exist on the server.","commonSituations":"Config Server not deployed or behind a broken LB; wrong config.uri / label (branch name) in bootstrap.yml; Config Server backends (git repo) unavailable; network/DNS issues in the container. Because fail-fast is set, application startup aborts with this exception.","solutions":["Check the wrapped cause in the stack trace — it distinguishes connect-refused (wrong URI/server down) from HTTP 404/5xx (label/profile or backend problem).","Fix the Config Server connection: verify spring.cloud.config.uri, the label/branch, and profiles; open the same /env endpoint in curl to confirm.","If startup should tolerate config-server unavailability, set fail-fast to false (sentinel-rule-source-spring-cloud-config.fail-fast=false or the corresponding property) so the locator logs a warning and continues.","If startup MUST fail on missing config (a valid choice), keep fail-fast=true and fix the server side — do not mask it."],"exampleFix":"# before (bootstrap.yml)\nsentinel-rule-source-spring-cloud-config:\n  fail-fast: true   # startup aborts when config server is unreachable\n\n# after\nsentinel-rule-source-spring-cloud-config:\n  fail-fast: false  # log warning and continue without remote rules","handlingStrategy":"try-catch","validationCode":"// before startup, probe the config server endpoint\n// curl -fsS \"$CONFIG_URI/{label}/{app}-{profile}.yml\" or in code:\nRestTemplate t = new RestTemplate();\nt.getForObject(configUri + \"/\" + label + \"/\" + app + \"-\" + profile + \".yml\", String.class); // throws early with clear cause","typeGuard":null,"tryCatchPattern":"try {\n    PropertySource<?> ps = ruleLocator.locate(environment);\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"fail fast\")) {\n        log.error(\"Config Server unreachable/label missing; wrapped cause: {}\",\n            e.getCause() == null ? \"none\" : e.getCause().getMessage());\n    }\n    throw e; // or degrade gracefully if fail-fast was not intentional\n}","preventionTips":["Keep fail-fast=true only when startup must abort without remote config; otherwise set it false.","Monitor Config Server health and the correctness of label/branch/profile values.","Read the wrapped cause — it distinguishes connectivity from label-not-found."],"tags":["sentinel","spring-cloud-config","config-server","fail-fast","startup-failure","java"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}