{"record":{"id":"fdc2b10d1c9ffc4a","repo":"apache/cassandra","slug":"no-valid-dhcp-lease-file-could-be-found","errorCode":null,"errorMessage":"No valid DHCP lease file could be found.","messagePattern":"No valid DHCP lease file could be found\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/locator/CloudstackLocationProvider.java","lineNumber":100,"sourceCode":"    private static String csMetadataEndpoint() throws ConfigurationException\n    {\n        for (String lease_uri : LEASE_FILES)\n        {\n            try\n            {\n                File lease_file = new File(new URI(lease_uri));\n                if (lease_file.exists())\n                {\n                    return csEndpointFromLease(lease_file);\n                }\n            }\n            catch (Exception e)\n            {\n                JVMStabilityInspector.inspectThrowable(e);\n            }\n        }\n\n        throw new ConfigurationException(\"No valid DHCP lease file could be found.\");\n    }\n\n    private static String csEndpointFromLease(File lease) throws ConfigurationException\n    {\n        String line;\n        String endpoint = null;\n        Pattern identifierPattern = Pattern.compile(\"^[ \\t]*option dhcp-server-identifier (.*);$\");\n\n        try (BufferedReader reader = new BufferedReader(new FileReader(lease)))\n        {\n\n            while ((line = reader.readLine()) != null)\n            {\n                Matcher matcher = identifierPattern.matcher(line);\n\n                if (matcher.find())\n                {\n                    endpoint = matcher.group(1);","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/CloudstackLocationProvider.java#L82-L118","documentation":"Thrown by CloudstackLocationProvider.csMetadataEndpoint() after scanning common locations for a DHCP lease file containing a CloudStack metadata-server entry and finding none. The provider needs the lease file to discover the metadata endpoint, so startup fails with a ConfigurationException.","triggerScenarios":"csMetadataEndpoint() (called during provider construction) when no lease file at the checked paths exists or none yields an endpoint; the earlier per-file exceptions are swallowed by JVMStabilityInspector and only this final error is thrown.","commonSituations":"Running in a container/VM without /var/lib/dhcp* lease files; dhclient lease paths differ from the hardcoded locations; node not actually on CloudStack.","solutions":["Ensure a DHCP lease file exists at one of the expected paths (/var/lib/dhcp/dhclient*.leases etc.)","Confirm the lease file contains an RFC3442/static-routes entry pointing at the CloudStack metadata server","Configure the metadata endpoint explicitly or switch to a snitch that does not rely on DHCP leases"],"exampleFix":"// before: no lease file present\n// after: verify with\n// grep -r domain-name-servers /var/lib/dhcp/dhclient*.leases\n// or place a valid dhclient lease at /var/lib/dhcp/dhclient.eth0.leases","handlingStrategy":"try-catch","validationCode":"File lease = Arrays.stream(CANDIDATE_PATHS).map(File::new).filter(File::exists).findFirst().orElse(null);\nif (lease == null) throw new IllegalStateException(\"No DHCP lease file at expected locations\");","typeGuard":null,"tryCatchPattern":"try { endpoint = csMetadataEndpoint(); } catch (ConfigurationException e) { logger.error(\"No CloudStack DHCP lease found; check /var/lib/dhcp\", e); throw e; }","preventionTips":["Verify lease file paths exist when packaging the node image","Prefer explicitly configured metadata endpoints where supported","Confirm CloudStack networking (shared networks write dhclient leases)"],"tags":["cloudstack","snitch","file-not-found","dhcp"],"backgroundTag":"file-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}