{"record":{"id":"2e28934407207e80","repo":"apache/cassandra","slug":"no-metadata-server-could-be-found-in-lease-file","errorCode":null,"errorMessage":"No metadata server could be found in lease file.","messagePattern":"No metadata server could be found in lease file\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/locator/CloudstackLocationProvider.java","lineNumber":130,"sourceCode":"            while ((line = reader.readLine()) != null)\n            {\n                Matcher matcher = identifierPattern.matcher(line);\n\n                if (matcher.find())\n                {\n                    endpoint = matcher.group(1);\n                    break;\n                }\n            }\n        }\n        catch (Exception e)\n        {\n            throw new ConfigurationException(\"CloudstackSnitch cannot access lease file.\");\n        }\n\n        if (endpoint == null)\n        {\n            throw new ConfigurationException(\"No metadata server could be found in lease file.\");\n        }\n\n        return \"http://\" + endpoint;\n    }\n}\n","sourceCodeStart":112,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/CloudstackLocationProvider.java#L112-L136","documentation":"CloudstackSnitch reads the Apache CloudStack lease file (typically /var/lib/cloudstack/data/leasefile) to discover the metadata server. If the file exists but contains no usable endpoint after parsing, CloudstackLocationProvider throws this ConfigurationException at startup, since the snitch cannot determine the node's datacenter/rack without it.","triggerScenarios":"csEndpointFromLease parses the lease file line-by-line expecting an 'server=<ip>' style entry; csMetadataEndpoint calls it and the returned endpoint is null — i.e. the lease file exists but has no recognizable server entry.","commonSituations":"Empty or malformed lease file on a CloudStack VM; running the snitch on a non-CloudStack host where the file exists but has unrelated content; CloudStack management server not having written its lease entry yet.","solutions":["Verify the lease file contains a valid server entry (e.g. 'server=192.168.1.1') and fix or regenerate it via CloudStack","Confirm cassandra.yaml points cloudkit/lease_file (via cloud-storage-location config) at the real CloudStack lease file path","If the host is not actually in CloudStack, switch to a different snitch (e.g. GossipingPropertyFileSnitch) in cassandra.yaml","Restart the CloudStack agent so the lease file is repopulated, then restart Cassandra"],"exampleFix":"// before (cassandra.yaml)\nendpoint_snitch: CloudstackSnitch\n// after\nendpoint_snitch: GossipingPropertyFileSnitch","handlingStrategy":"try-catch","validationCode":"File f = new File(leaseFilePath);\nboolean ok = f.exists() && new String(Files.readAllBytes(f.toPath())).contains(\"server=\");","typeGuard":null,"tryCatchPattern":"try { DatabaseDescriptor.createEndpointSnitch(...); }\ncatch (ConfigurationException e) { logger.error(\"CloudStack lease file unusable: {}\", e.getMessage()); throw e; }","preventionTips":["Assert the lease file exists and contains a server= line before starting Cassandra","Only use CloudstackSnitch on actual CloudStack instances","Pin the correct lease file path in cassandra.yaml"],"tags":["configuration","cloudstack","snitch","startup"],"backgroundTag":"resource-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}