apache/hadoop · error · InvalidRecordException

Missing address field: {}

Error message

Missing address field: {}

What it means

RegistryTypeUtils.getAddressField(address, field) looks up a key in an address map (e.g. 'uri' inside each address of a URI-typed endpoint) and throws InvalidRecordException ('Missing address field: <field>') when the key is absent or maps to null. retrieveAddressesUriType calls this per address entry.

Source

Thrown at hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java:217

    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,
      String field) throws InvalidRecordException {
    String val = address.get(field);
    if (val == null) {
      throw new InvalidRecordException("", "Missing address field: " + field);
    }
    return val;
  }

  /**
   * Get the address URLs. Guranteed to return at least one address.
   * @param epr endpoint
   * @return the address as a URL
   * @throws InvalidRecordException if the type is wrong, there are no addresses
   * or the payload ill-formatted
   * @throws MalformedURLException address can't be turned into a URL
   */
  public static List<URL> retrieveAddressURLs(Endpoint epr)
      throws InvalidRecordException, MalformedURLException {
    if (epr == null) {
      throw new InvalidRecordException("", "Null endpoint");
    }
    List<String> addresses = retrieveAddressesUriType(epr);

View on GitHub (pinned to 2add963021)

Solutions

  1. Build address entries only via RegistryTypeUtils.uri(value) / hostnamePortPair(...) so the expected keys ('uri', 'host', 'port') are always present
  2. When consuming, validate each map with address.containsKey("uri") (or the field you need) and skip malformed entries
  3. Re-register the offending service record with a correctly marshalled endpoint

Example fix

// before
Map<String, String> addr = new HashMap<>();
addr.put("url", "hdfs://nn:9820"); // wrong key
ep.addAddress(addr);

// after
ep.addAddress(RegistryTypeUtils.uri("hdfs://nn:9820")); // puts key "uri"
Defensive patterns

Strategy: validation

Validate before calling

for (Map<String, String> address : epr.addresses) {
  if (!address.containsKey(AddressTypes.ADDRESS_URI)) {
    LOG.warn("Skipping address without 'uri' key: {}", address);
    continue;
  }
  results.add(address.get(AddressTypes.ADDRESS_URI));
}

Type guard

static boolean hasAddressField(Map<String, String> address, String field) {
  return address != null && address.get(field) != null;
}

Prevention

When it happens

Trigger: An address map inside epr.addresses lacking the 'uri' key — for example {'url': 'hdfs://...'} (wrong key name) or an empty map — processed by retrieveAddressesUriType or retrieveAddressURLs.

Common situations: Records written by a different producer version or hand-crafted JSON with renamed keys; address maps built with put("url", ...) instead of the RegistryTypeUtils.uri(...) helper.

Understand the failure class

Background: "Missing required field" and "field is required" errors: why libraries reject payloads that omit mandatory fields — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/f7a1d0ec832aaf64. Report an issue: GitHub.