apache/hadoop · error · ServiceException
Request must contain identifier
Error message
Request must contain identifier
What it means
GenericRefreshProtocolServerSideTranslatorPB is the server-side translator for the generic refresh protocol used by 'hdfs dfsadmin -refresh'. The protobuf GenericRefreshRequest must carry the refresh handler identifier so the server can route the request to the registered RefreshHandler; a request with the identifier field absent fails fast with ServiceException("Request must contain identifier") before any refresh logic runs.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/protocolPB/GenericRefreshProtocolServerSideTranslatorPB.java:53
GenericRefreshProtocolPB {
private final GenericRefreshProtocol impl;
public GenericRefreshProtocolServerSideTranslatorPB(
GenericRefreshProtocol impl) {
this.impl = impl;
}
@Override
public GenericRefreshResponseCollectionProto refresh(
RpcController controller, GenericRefreshRequestProto request)
throws ServiceException {
try {
List<String> argList = request.getArgsList();
String[] args = argList.toArray(new String[argList.size()]);
if (!request.hasIdentifier()) {
throw new ServiceException("Request must contain identifier");
}
Collection<RefreshResponse> results = impl.refresh(request.getIdentifier(), args);
return pack(results);
} catch (IOException e) {
throw new ServiceException(e);
}
}
// Convert a collection of RefreshResponse objects to a
// RefreshResponseCollection proto
private GenericRefreshResponseCollectionProto pack(
Collection<RefreshResponse> responses) {
GenericRefreshResponseCollectionProto.Builder b =
GenericRefreshResponseCollectionProto.newBuilder();
for (RefreshResponse response : responses) {View on GitHub (pinned to 2add963021)
Solutions
- Always populate the identifier before sending: builder.setIdentifier("namenode") (the id a RefreshHandler registered under, e.g., 'namenode' for the NameNode's refresh handler).
- Prefer the stock 'hdfs dfsadmin -refresh <host:port> <identifier> [args...]' CLI, which builds a well-formed request.
- When implementing your own translator/service, catch ServiceException client-side and surface the message instead of swallowing it.
Example fix
// before
GenericRefreshRequestProto req = GenericRefreshRequestProto.newBuilder()
.addAllArgs(args).build();
// after
GenericRefreshRequestProto req = GenericRefreshRequestProto.newBuilder()
.setIdentifier("namenode").addAllArgs(args).build(); Defensive patterns
Strategy: validation
Validate before calling
// Client-side: check the field before sending
if (!request.hasIdentifier()) {
throw new IllegalArgumentException("GenericRefreshRequest requires an identifier "
+ "(the RefreshHandler id, e.g. 'namenode')");
}
Collection<RefreshResponse> out = refreshProxy.refresh(request.getIdentifier(), args); Try / catch
try {
return pack(impl.refresh(request.getIdentifier(), args));
} catch (ServiceException se) {
if (se.getMessage().contains("identifier")) {
// malformed request from a custom/skewed client; reject with clear message
throw new ServiceException("Refresh request must set the 'identifier' field", se);
}
throw se;
} Prevention
- Always build GenericRefreshRequestProto with setIdentifier(<RefreshHandler id>).
- Prefer the stock 'hdfs dfsadmin -refresh' client over hand-rolled protobuf calls.
- In custom RefreshHandler implementations, log the identifier you register under so callers know what to send.
When it happens
Trigger: Invoking GenericRefreshProtocol.refresh() (directly or via a raw protobuf client) with a request built without setIdentifier(...); 'hdfs dfsadmin -refresh <host:port> <identifier>' without the identifier argument in a custom wrapper; version-skewed clients that do not populate the field.
Common situations: Writing custom admin tooling on top of GenericRefreshProtocol; test harnesses that hand-assemble protos; upgrading dfsadmin wrappers that previously passed positional args differently.
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
- Too many or few parameters for request. Method: [{}], Expect
- null param while calling Method: [{}]
- Unknown method {} called on {} protocol.
- Too many or few parameters for request. Method: [{}], Expect
- null param while calling Method: [{}]
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/74b80d6f5f914752.
Report an issue: GitHub.