apache/hadoop · error · InvalidRecordException
Address type of %s does not match required type of %s
Error message
Address type of %s does not match required type of %s
What it means
RegistryTypeUtils.requireAddressType(expected, epr) enforces that an Endpoint's addressType matches what the accessor can parse — retrieveAddressesUriType requires AddressTypes.ADDRESS_URI ('uri'). A mismatch throws InvalidRecordException stating the actual and required types. Other known types include 'host/port' (ADDRESS_HOSTNAME_AND_PORT) with field 'host'.
Source
Thrown at hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java:171
* Create a (hostname, port) address pair
* @param address socket address whose hostname and port are used for the
* generated address.
* @return a 1 entry map.
*/
public static Map<String, String> hostnamePortPair(InetSocketAddress address) {
return hostnamePortPair(address.getHostName(), address.getPort());
}
/**
* Require a specific address type on an endpoint
* @param required required type
* @param epr endpoint
* @throws InvalidRecordException if the type is wrong
*/
public static void requireAddressType(String required, Endpoint epr) throws
InvalidRecordException {
if (!required.equals(epr.addressType)) {
throw new InvalidRecordException(
epr.toString(),
"Address type of " + epr.addressType
+ " does not match required type of "
+ required);
}
}
/**
* Get a single URI endpoint
* @param epr endpoint
* @return the uri of the first entry in the address list. Null if the endpoint
* itself is null
* @throws InvalidRecordException if the type is wrong, there are no addresses
* or the payload ill-formatted
*/
public static List<String> retrieveAddressesUriType(Endpoint epr)
throws InvalidRecordException {
if (epr == null) {View on GitHub (pinned to 2add963021)
Solutions
- Branch on epr.addressType first: use retrieveAddressesUriType/retrieveAddressURLs for 'uri' endpoints and hostname/port accessors for 'host/port' endpoints
- When publishing, stamp the type that matches the payload — RegistryTypeUtils.uri(...) already sets 'uri'
- Catch InvalidRecordException per endpoint, log and skip the mismatched entry, and continue with the rest of the record
Example fix
// before
List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(endpoint); // endpoint is host/port typed
// after
if (AddressTypes.ADDRESS_URI.equals(endpoint.addressType)) {
List<URL> urls = RegistryTypeUtils.retrieveAddressURLs(endpoint);
} else if (AddressTypes.ADDRESS_HOSTNAME_AND_PORT.equals(endpoint.addressType)) {
InetSocketAddress addr = RegistryTypeUtils.retrieveAddressAddr(endpoint);
} Defensive patterns
Strategy: validation
Validate before calling
if (!AddressTypes.ADDRESS_URI.equals(endpoint.addressType)) {
// not a uri endpoint — use the hostname/port accessors instead of failing
InetSocketAddress sa = RegistryTypeUtils.retrieveAddressAddr(endpoint);
} else {
List<String> uris = RegistryTypeUtils.retrieveAddressesUriType(endpoint);
} Type guard
static boolean isUriEndpoint(Endpoint epr) {
return epr != null && AddressTypes.ADDRESS_URI.equals(epr.addressType);
} Try / catch
for (Endpoint epr : record.external) {
try {
urls.addAll(RegistryTypeUtils.retrieveAddressURLs(epr));
} catch (InvalidRecordException e) {
LOG.warn("Skipping endpoint with wrong address type: {}", e.getMessage());
}
} Prevention
- Check epr.addressType before choosing an accessor — registries hold mixed 'uri' and 'host/port' endpoints
- Publish with RegistryTypeUtils.uri(...)/hostnamePortPair(...) so the type always matches the payload
- Process endpoints defensively: one malformed endpoint should not abort the whole record
When it happens
Trigger: Calling retrieveAddressesUriType or retrieveAddressURLs on an endpoint published with host/port addressing (the style YARN API records use), or with any custom addressType string.
Common situations: Reading a mixed registry where some endpoints are URI-typed and others host/port-typed; consumer code assuming every endpoint of a service shares one address type.
Related errors
- No addresses in endpoint
- Null endpoint
- Invalid Path "%s" : %s
- Invalid Path element "%s"
- Missing address field: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/b9d8cab5a214e328.
Report an issue: GitHub.