{"record":{"id":"463d09ecfa625fa6","repo":"apache/cassandra","slug":"cannot-generate-the-node-component-of-the-uuid-bec","errorCode":null,"errorMessage":"Cannot generate the node component of the UUID because cannot retrieve any IP addresses.","messagePattern":"Cannot generate the node component of the UUID because cannot retrieve any IP addresses\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/utils/TimeUUID.java","lineNumber":530,"sourceCode":"            return lsb;\n        }\n\n        private static long makeNode()\n        {\n            /*\n             * We don't have access to the MAC address but need to generate a node part\n             * that identify this host as uniquely as possible.\n             * The spec says that one option is to take as many source that identify\n             * this node as possible and hash them together. That's what we do here by\n             * gathering all the ip of this host.\n             * Note that FBUtilities.getJustBroadcastAddress() should be enough to uniquely\n             * identify the node *in the cluster* but it triggers DatabaseDescriptor\n             * instanciation and the UUID generator is used in Stress for instance,\n             * where we don't want to require the yaml.\n             */\n            Collection<InetAddressAndPort> localAddresses = getAllLocalAddresses();\n            if (localAddresses.isEmpty())\n                throw new RuntimeException(\"Cannot generate the node component of the UUID because cannot retrieve any IP addresses.\");\n\n            // ideally, we'd use the MAC address, but java doesn't expose that.\n            byte[] hash = hash(localAddresses);\n            long node = 0;\n            for (int i = 0; i < Math.min(6, hash.length); i++)\n                node |= (0x00000000000000ff & (long)hash[i]) << (5-i)*8;\n            assert (0xff00000000000000L & node) == 0;\n\n            // Since we don't use the mac address, the spec says that multicast\n            // bit (least significant bit of the first octet of the node ID) must be 1.\n            return node | 0x0000010000000000L;\n        }\n\n        private static byte[] hash(Collection<InetAddressAndPort> data)\n        {\n            // Identify the host.\n            Hasher hasher = Hashing.md5().newHasher();\n            for(InetAddressAndPort addr : data)","sourceCodeStart":512,"sourceCodeEnd":548,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/utils/TimeUUID.java#L512-L548","documentation":"TimeUUID.makeNode builds the 48-bit node component of generated v1 UUIDs by hashing all locally detected IP addresses. If getAllLocalAddresses() returns an empty set it cannot construct the node component and throws this RuntimeException.","triggerScenarios":"Calling TimeUUID generation (makeClockSeqAndNode → makeNode) on a machine where no network interfaces/addresses can be enumerated — no NICs up, restricted /proc or NetworkInterface enumeration failing, or a heavily sandboxed container with no addresses.","commonSituations":"Running Cassandra tooling/stress in minimal Docker or chroot environments without configured networking, unusual JVM security policies blocking NetworkInterface access, or hosts with all interfaces down at JVM startup.","solutions":["Configure at least one network interface (even loopback-assigned address) and bring it up","Check java.net.NetworkInterface enumeration in the environment (container --net settings, security manager)","Restart the JVM after networking is available — the node value is computed once per process","For isolated environments, patch/wrap getAllLocalAddresses to provide a deterministic fallback node id"],"exampleFix":"// before (no NIC) -> RuntimeException at UUID generation\n// after\nip link set lo up && ip addr add 127.0.0.1/8 dev lo  # ensure at least one address, then restart JVM","handlingStrategy":"fallback","validationCode":"boolean hasLocalAddress() { try { return java.net.NetworkInterface.getNetworkInterfaces().asIterator().hasNext(); } catch (Exception e) { return false; } }","typeGuard":null,"tryCatchPattern":"try { TimeUUID.Generator.generateTimeUUIDBytes(); } catch (RuntimeException e) { if (e.getMessage().contains(\"cannot retrieve any IP addresses\")) { /* configure networking or supply a fallback node id */ } else throw e; }","preventionTips":["Ensure at least one interface with an address exists in containers/chroots","Bring up loopback if running in minimal environments","Initialize UUID generation after networking is up; restart JVM if NICs changed","For sandboxes, seed a deterministic node value via a custom getAllLocalAddresses override"],"tags":["uuid","network-interfaces","environment"],"backgroundTag":"missing-env-var","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"}