| Previous | Next |
| ERROR_LOGIN_WKSTA_RESTRICTION | ERROR_ALREADY_REGISTERED |
ERROR_INCORRECT_ADDRESS
The network address is unsuitable for this operation.
ERROR_INCORRECT_ADDRESS is Win32 error 1241 (0x4D9). The address may be syntactically recognizable yet invalid in the operation’s context—for example, the wrong address family, scope, interface, endpoint role, or provider-specific address type.
Contextual address failures
- an IPv6 link-local address is used without the required scope ID
- an IPv4 address is supplied to an IPv6-only endpoint or the reverse
- a remote address is passed where the API requires a local interface address
- broadcast, multicast, loopback, or unspecified addresses are used for an unsupported role
- the address belongs to an interface that has been removed or moved to another compartment
- a binary socket address has the wrong length for its family
Evidence to capture
Record the operation, address family, canonical numeric address, prefix or port, scope ID, interface index, structure length, and whether the address is intended as local or remote. Preserve the result of name resolution separately so support can distinguish resolver selection from later address validation.
Diagnostic sequence
Parse the address with the platform’s address-family-aware functions, then validate it against the operation contract. Enumerate current interfaces and compare the address with their assigned unicast, multicast, and route state. For IPv6, verify scope and zone identifiers; for dual-stack code, inspect which candidate from getaddrinfo was actually chosen.
Recovery strategy
Select an address compatible with the endpoint and current interface state, rebuild the socket or provider object if necessary, and retry from initialization. Do not merely retry the same unusable address. When configuration specifies a retired static address, surface that exact field to the administrator rather than falling back silently to an arbitrary interface.
Difference from related network codes
ERROR_ADDRESS_NOT_ASSOCIATED means the endpoint has no address yet. ERROR_INVALID_ADDRESS is used by other APIs for invalid memory or address values. ERROR_NETWORK_UNREACHABLE says a valid destination has no usable route. Error 1241 says this address cannot serve the requested purpose.
Developer recommendations
- store addresses as structured family-specific values
- carry IPv6 scope IDs through serialization
- avoid guessing local interfaces from string prefixes
- react to adapter and route changes
- test loopback, link-local, dual-stack, VPN, and interface-removal cases
Example
A discovery service saves the link-local address fe80::25 but omits its interface scope. After restart it tries to send through a generic IPv6 socket and receives 1241 because the address is ambiguous across interfaces. Persisting the interface index and rebuilding the scoped address resolves the operation.
References
- Microsoft: System Error Codes (1000–1299)
- Microsoft: SOCKADDR structures
- Microsoft: getaddrinfo function
- Microsoft: GetAdaptersAddresses function
Looking for a different code? Search another status or error code.