{"record":{"id":"12cbb3d8176f0cff","repo":"apache/hadoop","slug":"no-addresses-in-endpoint","errorCode":null,"errorMessage":"No addresses in endpoint","messagePattern":"No addresses in endpoint","errorType":"exception","errorClass":"InvalidRecordException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java","lineNumber":195,"sourceCode":"  }\n\n  /**\n   * Get a single URI endpoint\n   * @param epr endpoint\n   * @return the uri of the first entry in the address list. Null if the endpoint\n   * itself is null\n   * @throws InvalidRecordException if the type is wrong, there are no addresses\n   * or the payload ill-formatted\n   */\n  public static List<String> retrieveAddressesUriType(Endpoint epr)\n      throws InvalidRecordException {\n    if (epr == null) {\n      return null;\n    }\n    requireAddressType(ADDRESS_URI, epr);\n    List<Map<String, String>> addresses = epr.addresses;\n    if (addresses.size() < 1) {\n      throw new InvalidRecordException(epr.toString(),\n          \"No addresses in endpoint\");\n    }\n    List<String> results = new ArrayList<String>(addresses.size());\n    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,","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/binding/RegistryTypeUtils.java#L177-L213","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nEndpoint ep = new Endpoint(\"webhdfs\", \"uri\", \"/webhdfs\");\nrecord.addExternal(ep); // addresses empty -> No addresses in endpoint on read\n\n// after\nEndpoint ep = new Endpoint(\"webhdfs\", \"uri\", \"/webhdfs\");\nep.addAddress(RegistryTypeUtils.uri(\"hdfs://namenode:9820\"));\nrecord.addExternal(ep);","handlingStrategy":"validation","validationCode":"static boolean hasAddresses(Endpoint epr) {\n  return epr != null && epr.addresses != null && !epr.addresses.isEmpty();\n}\n\nif (hasAddresses(epr) && AddressTypes.ADDRESS_URI.equals(epr.addressType)) {\n  List<String> uris = RegistryTypeUtils.retrieveAddressesUriType(epr);\n}","typeGuard":"static boolean isRetrievableUriEndpoint(Endpoint epr) {\n  return epr != null\n      && AddressTypes.ADDRESS_URI.equals(epr.addressType)\n      && epr.addresses != null && !epr.addresses.isEmpty();\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["registry","endpoint","addresses","validation"],"backgroundTag":"empty-address-list","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}