SonarSource/sonarqube · info
Unable to get a valid mac address, will use a dummy address
Error message
Unable to get a valid mac address, will use a dummy address
What it means
After (possibly) catching a SocketException, getSecureMungedAddress() validates the MAC address. If the address is null or not a valid unicast address (e.g. loopback, all-zero), this second warning is logged and a locally-administered dummy multicast address is constructed. Server id generation continues using secure random munged bytes, so this is a fallback, not a failure.
Solutions
- Bring up a real network interface so a valid MAC is visible to the JVM.
- If server id must be stable across clones/containers, generate it once and reuse it (server id management in Administration > System), rather than relying on the MAC.
- Accept the dummy address if the server id is stored — it remains valid and unique.
- Check JVM access to interface hardware addresses (some hardened environments block reading hwaddr).
- Only investigate if you see this warning repeatedly with changing server ids, e.g. licensing or telemetry issues.
Example fix
// before ip link set eth0 down // after ip link set eth0 up
Defensive patterns
Strategy: fallback
Validate before calling
# ensure a real MAC is visible before server-id generation
mac=$(cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address 2>/dev/null)
[ -n "$mac" ] && [ "$mac" != "00:00:00:00:00:00" ] || echo 'WARNING: invalid MAC, server id will use dummy address' Try / catch
// treat the warning as benign if the server id is persisted; alert only on instability
if (!MacAddressProvider.isValidAddress(address)) {
logger.warn("Using dummy MAC for server id; persist the server id to keep it stable");
} Prevention
- Bring up a physical/virtual NIC so a valid MAC is reported.
- On cloned VMs, reuse an existing server id instead of regenerating.
- Ignore the warning only when server id persistence is confirmed.
- Verify hardware address visibility from the JVM on hardened hosts.
When it happens
Trigger: NetworkInterface enumeration returned only invalid addresses (loopback-only VMs, all-zero MACs from virtualized NICs, certain VPS/cloud instances) so isValidAddress(address) returns false.
Common situations: Cloud VMs or containers with virtual NICs reporting zeroed MACs; hosts with only the loopback interface up; network drivers reporting null hardware addresses; Mac OS/Linux environments with unusual bonding/virtual bridges.
Related errors
- Unable to get mac address, will use a dummy address
- Can not resolve host [
- Fail to download
- Fail to execute request
- Failed to publish telemetry event
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/8c9d47c4c85732d9.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-server-common/src/main/java/org/sonar/server/platform/serverid/MacAddressProvider.java:56
private static final Logger LOGGER = LoggerFactory.getLogger(MacAddressProvider.class);
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
public static final int BYTE_SIZE = 6;
private MacAddressProvider() {
// only static stuff
}
public static byte[] getSecureMungedAddress() {
byte[] address = null;
try {
address = getMacAddress();
} catch (SocketException se) {
LOGGER.warn("Unable to get mac address, will use a dummy address", se);
// address will be set below
}
if (!isValidAddress(address)) {
LOGGER.warn("Unable to get a valid mac address, will use a dummy address");
address = constructDummyMulticastAddress();
}
byte[] mungedBytes = new byte[BYTE_SIZE];
SECURE_RANDOM.nextBytes(mungedBytes);
for (int i = 0; i < BYTE_SIZE; ++i) {
mungedBytes[i] ^= address[i];
}
return mungedBytes;
}
private static boolean isValidAddress(@Nullable byte[] address) {
if (address == null || address.length != BYTE_SIZE) {
return false;
}
for (byte b : address) {
if (b != 0x00) {View on GitHub (pinned to 184c821202)