EREMCHG
Linux / POSIXERRORNotableNetworkHIGH confidence

Remote Address Changed

Production Risk

Rare; indicates IP mobility or failover scenario.

What this means

EREMCHG (errno 78) is returned when the remote address of a connection has changed unexpectedly, breaking an established connection.

Why it happens
  1. 1Remote host IP address changed mid-connection (failover or IP change)
How to reproduce

Connection to a host that changes its IP address.

trigger — this will error
trigger — this will error
// errno = EREMCHG when remote IP changes unexpectedly

expected output

Remote address changed (EREMCHG)

Fix

Reconnect to the new address

WHEN After EREMCHG

Reconnect to the new address
if (errno == EREMCHG) {
  close(sockfd);
  // Re-resolve hostname to get new address
  // Reconnect to updated address
  sockfd = connect_to_host(hostname, port);
}

Why this works

Close the old connection, re-resolve the hostname via DNS, and reconnect.

Sources
Official documentation ↗

Linux Programmer Manual errno(3)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors