What does Windows error code 1228 (ERROR_ADDRESS_NOT_ASSOCIATED) mean?

 
Previous Next
ERROR_ADDRESS_ALREADY_ASSOCIATED ERROR_CONNECTION_INVALID

ERROR_ADDRESS_NOT_ASSOCIATED

The network endpoint has not been assigned an address.

ERROR_ADDRESS_NOT_ASSOCIATED is Win32 error 1228 (0x4CC). A network operation expected its endpoint to have an associated address, but the required bind, connect, or provider-specific association has not occurred. The endpoint object can exist while still lacking usable local addressing state.

Typical programming causes

  • calling an address-dependent operation before bind or successful connect
  • continuing after an earlier bind failure
  • reusing an endpoint after a transport reset without rebuilding its state
  • querying a local address before an implicit bind has taken place
  • mixing address-family or provider objects across initialization paths

State to record

Capture socket or endpoint identifier, address family, protocol, operation, prior bind/connect result, local interface selection, and thread sequence. Log addresses in structured form with IPv6 scope IDs. A trace that contains only 1228 hides the earlier call that failed to establish the association.

Diagnostic sequence

Verify that endpoint creation succeeded, then inspect every state transition before the failing call. Check the return value of bind or connect immediately and preserve its native Winsock or provider error. Use getsockname only when the socket state permits it, and confirm that the expected address family matches the endpoint.

Recovery

If association never occurred, correct the local address and repeat initialization from a clean endpoint. After a reset or failed connect, creating a new socket is often safer than guessing which operations remain valid on the old one. Do not loop on the final address-dependent call while leaving the endpoint unbound.

Difference from related transport errors

ERROR_ADDRESS_ALREADY_ASSOCIATED is the opposite lifecycle mistake: an address is already attached when another association is attempted. ERROR_INCORRECT_ADDRESS says an address cannot be used for the requested operation. ERROR_NETWORK_UNREACHABLE concerns routing after addressing is available.

Developer guidance

  • model endpoint state explicitly
  • fail fast after bind or connect errors
  • avoid sharing partially initialized sockets with worker threads
  • include address family and scope in diagnostics
  • test interface removal and reconnect paths

Example

A UDP service creates an IPv6 socket and starts a worker before its bind step completes. Bind fails because the configured interface no longer exists, but the error is ignored. The worker later queries endpoint state and receives 1228. Propagating the bind failure and publishing the socket only after successful association fixes the race.

References


Looking for a different code? Search another status or error code.