apache/cassandra · error · ConfigurationException

No valid DHCP lease file could be found.

Error message

No valid DHCP lease file could be found.

What it means

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.

Solutions

  1. Ensure a DHCP lease file exists at one of the expected paths (/var/lib/dhcp/dhclient*.leases etc.)
  2. Confirm the lease file contains an RFC3442/static-routes entry pointing at the CloudStack metadata server
  3. Configure the metadata endpoint explicitly or switch to a snitch that does not rely on DHCP leases

Example fix

// before: no lease file present
// after: verify with
// grep -r domain-name-servers /var/lib/dhcp/dhclient*.leases
// or place a valid dhclient lease at /var/lib/dhcp/dhclient.eth0.leases
Defensive patterns

Strategy: try-catch

Validate before calling

File lease = Arrays.stream(CANDIDATE_PATHS).map(File::new).filter(File::exists).findFirst().orElse(null);
if (lease == null) throw new IllegalStateException("No DHCP lease file at expected locations");

Try / catch

try { endpoint = csMetadataEndpoint(); } catch (ConfigurationException e) { logger.error("No CloudStack DHCP lease found; check /var/lib/dhcp", e); throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: Running in a container/VM without /var/lib/dhcp* lease files; dhclient lease paths differ from the hardcoded locations; node not actually on CloudStack.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/fdc2b10d1c9ffc4a. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/locator/CloudstackLocationProvider.java:100

    private static String csMetadataEndpoint() throws ConfigurationException
    {
        for (String lease_uri : LEASE_FILES)
        {
            try
            {
                File lease_file = new File(new URI(lease_uri));
                if (lease_file.exists())
                {
                    return csEndpointFromLease(lease_file);
                }
            }
            catch (Exception e)
            {
                JVMStabilityInspector.inspectThrowable(e);
            }
        }

        throw new ConfigurationException("No valid DHCP lease file could be found.");
    }

    private static String csEndpointFromLease(File lease) throws ConfigurationException
    {
        String line;
        String endpoint = null;
        Pattern identifierPattern = Pattern.compile("^[ \t]*option dhcp-server-identifier (.*);$");

        try (BufferedReader reader = new BufferedReader(new FileReader(lease)))
        {

            while ((line = reader.readLine()) != null)
            {
                Matcher matcher = identifierPattern.matcher(line);

                if (matcher.find())
                {
                    endpoint = matcher.group(1);

View on GitHub (pinned to 88fd0f6a0e)