| Previous | Next |
| DNS_ERROR_INVALID_TYPE | DNS_ERROR_INVALID_PROPERTY |
DNS_ERROR_INVALID_IP_ADDRESS
Separate address parsing from name resolution
DNS_ERROR_INVALID_IP_ADDRESS indicates that an input expected to represent an IP address could not be accepted. A URL, socket endpoint, CIDR prefix, or bracketed IPv6 literal is not automatically a plain address. For example, [2001:db8::1]:443 contains valid endpoint syntax but is not a valid input to an API expecting only the address text.
Hand-written validation is error-prone, particularly for compressed IPv6 forms. Use an address parser appropriate to the target family and preserve the original text for diagnostics. Decide separately whether the surrounding operation permits IPv6 scope identifiers, IPv4-mapped forms, or reverse-lookup names.
What to inspect
- Log the exact input including whitespace and delimiters; avoid normalizing away the evidence before validation.
- Remove a port, URI brackets, or CIDR suffix only when the caller’s contract says those components are allowed.
- Use
InetPtonor an equivalent standards-aware parser rather than counting dots or colons. - For reverse DNS, construct the correct
in-addr.arpaorip6.arpaquery only after the address parses successfully.
References
- Microsoft: InetPtonW
- RFC 4291: IPv6 Addressing Architecture
- RFC 3596: DNS Extensions to Support IPv6
Looking for a different code? Search another status or error code.