apache/hadoop · error · InvalidRecordException
No addresses in endpoint
Error message
No addresses in endpoint
What it means
retrieveAddressesUriType requires the endpoint's address list to contain at least one entry after passing the addressType check; an empty addresses list throws InvalidRecordException ('No addresses in endpoint'). The endpoint is typed correctly but was serialized with an empty or cleared address array.
Source
Thrown at hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java:195
}
/**
* 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) {
return null;
}
requireAddressType(ADDRESS_URI, epr);
List<Map<String, String>> addresses = epr.addresses;
if (addresses.size() < 1) {
throw new InvalidRecordException(epr.toString(),
"No addresses in endpoint");
}
List<String> results = new ArrayList<String>(addresses.size());
for (Map<String, String> address : addresses) {
results.add(getAddressField(address, ADDRESS_URI));
}
return results;
}
/**
* Get a specific field from an address -raising an exception if
* the field is not present
* @param address address to query
* @param field field to resolve
* @return the resolved value. Guaranteed to be non-null.
* @throws InvalidRecordException if the field did not resolve
*/
public static String getAddressField(Map<String, String> address,View on GitHub (pinned to 2add963021)
Solutions
- When publishing, always add at least one address (RegistryTypeUtils.uri(...) / hostnamePortPair(...)) before registering the record — Endpoint.validate also rejects empty lists
- When consuming, check epr.addresses != null && !epr.addresses.isEmpty() before calling the retriever and skip/log the endpoint
- Fix the writer: re-register the service record with populated addresses
Example fix
// before
Endpoint ep = new Endpoint("webhdfs", "uri", "/webhdfs");
record.addExternal(ep); // addresses empty -> No addresses in endpoint on read
// after
Endpoint ep = new Endpoint("webhdfs", "uri", "/webhdfs");
ep.addAddress(RegistryTypeUtils.uri("hdfs://namenode:9820"));
record.addExternal(ep); Defensive patterns
Strategy: validation
Validate before calling
static boolean hasAddresses(Endpoint epr) {
return epr != null && epr.addresses != null && !epr.addresses.isEmpty();
}
if (hasAddresses(epr) && AddressTypes.ADDRESS_URI.equals(epr.addressType)) {
List<String> uris = RegistryTypeUtils.retrieveAddressesUriType(epr);
} Type guard
static boolean isRetrievableUriEndpoint(Endpoint epr) {
return epr != null
&& AddressTypes.ADDRESS_URI.equals(epr.addressType)
&& epr.addresses != null && !epr.addresses.isEmpty();
} Prevention
- Never register an Endpoint without at least one address — Endpoint.validate rejects it too
- Add addresses via RegistryTypeUtils.uri(...)/hostnamePortPair(...) before record registration
- Treat an empty-address endpoint as bad publisher data: log and skip rather than fail the whole read
When it happens
Trigger: A ServiceRecord published with an Endpoint whose addresses list is empty — e.g. new Endpoint(api, "uri", ...) with no addresses added — or JSON deserialized from a record where the addresses array is empty.
Common situations: Registration code that creates the Endpoint before resolving the service address and never populates it; schema changes that stopped writing the addresses field; hand-built records in tests.
Related errors
- Address type of %s does not match required type of %s
- Missing address field: {}
- Null endpoint
- Invalid Path "%s" : %s
- Invalid Path element "%s"
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/12cbb3d8176f0cff.
Report an issue: GitHub.