{"record":{"id":"f7a1d0ec832aaf64","repo":"apache/hadoop","slug":"missing-address-field","errorCode":null,"errorMessage":"Missing address field: {}","messagePattern":"Missing address field: (.+?)","errorType":"validation","errorClass":"InvalidRecordException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java","lineNumber":217,"sourceCode":"    for (Map<String, String> address : addresses) {\n      results.add(getAddressField(address, ADDRESS_URI));\n    }\n    return results;\n  }\n\n  /**\n   * Get a specific field from an address -raising an exception if\n   * the field is not present\n   * @param address address to query\n   * @param field field to resolve\n   * @return the resolved value. Guaranteed to be non-null.\n   * @throws InvalidRecordException if the field did not resolve\n   */\n  public static String getAddressField(Map<String, String> address,\n      String field) throws InvalidRecordException {\n    String val = address.get(field);\n    if (val == null) {\n      throw new InvalidRecordException(\"\", \"Missing address field: \" + field);\n    }\n    return val;\n  }\n\n  /**\n   * Get the address URLs. Guranteed to return at least one address.\n   * @param epr endpoint\n   * @return the address as a URL\n   * @throws InvalidRecordException if the type is wrong, there are no addresses\n   * or the payload ill-formatted\n   * @throws MalformedURLException address can't be turned into a URL\n   */\n  public static List<URL> retrieveAddressURLs(Endpoint epr)\n      throws InvalidRecordException, MalformedURLException {\n    if (epr == null) {\n      throw new InvalidRecordException(\"\", \"Null endpoint\");\n    }\n    List<String> addresses = retrieveAddressesUriType(epr);","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java#L199-L235","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Build address entries only via RegistryTypeUtils.uri(value) / hostnamePortPair(...) so the expected keys ('uri', 'host', 'port') are always present","When consuming, validate each map with address.containsKey(\"uri\") (or the field you need) and skip malformed entries","Re-register the offending service record with a correctly marshalled endpoint"],"exampleFix":"// before\nMap<String, String> addr = new HashMap<>();\naddr.put(\"url\", \"hdfs://nn:9820\"); // wrong key\nep.addAddress(addr);\n\n// after\nep.addAddress(RegistryTypeUtils.uri(\"hdfs://nn:9820\")); // puts key \"uri\"","handlingStrategy":"validation","validationCode":"for (Map<String, String> address : epr.addresses) {\n  if (!address.containsKey(AddressTypes.ADDRESS_URI)) {\n    LOG.warn(\"Skipping address without 'uri' key: {}\", address);\n    continue;\n  }\n  results.add(address.get(AddressTypes.ADDRESS_URI));\n}","typeGuard":"static boolean hasAddressField(Map<String, String> address, String field) {\n  return address != null && address.get(field) != null;\n}","tryCatchPattern":null,"preventionTips":["Create address maps only with RegistryTypeUtils.uri(value) / hostnamePortPair(...) so keys are always correct","Do not hand-write address JSON with renamed keys like 'url' instead of 'uri'","Validate address maps at publish time (Endpoint.validate) so bad data never reaches readers"],"tags":["registry","endpoint","addresses","missing-field"],"backgroundTag":"missing-required-field","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}