apache/hadoop · error · IllegalArgumentException
Bad status:
Error message
Bad status:
What it means
PBHelper.convert(ReceivedDeletedBlockInfo) serializes a block-report delta entry (block plus RECEIVING/RECEIVED/DELETED status) between NameNode and Datanode. The switch covers exactly three statuses; anything else reaches the default branch and throws IllegalArgumentException naming the offending status.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java:729
public static ReceivedDeletedBlockInfoProto convert(
ReceivedDeletedBlockInfo receivedDeletedBlockInfo) {
ReceivedDeletedBlockInfoProto.Builder builder =
ReceivedDeletedBlockInfoProto.newBuilder();
ReceivedDeletedBlockInfoProto.BlockStatus status;
switch (receivedDeletedBlockInfo.getStatus()) {
case RECEIVING_BLOCK:
status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVING;
break;
case RECEIVED_BLOCK:
status = ReceivedDeletedBlockInfoProto.BlockStatus.RECEIVED;
break;
case DELETED_BLOCK:
status = ReceivedDeletedBlockInfoProto.BlockStatus.DELETED;
break;
default:
throw new IllegalArgumentException("Bad status: " +
receivedDeletedBlockInfo.getStatus());
}
builder.setStatus(status);
if (receivedDeletedBlockInfo.getDelHints() != null) {
builder.setDeleteHint(receivedDeletedBlockInfo.getDelHints());
}
return builder.setBlock(
PBHelperClient.convert(receivedDeletedBlockInfo.getBlock())).build();
}
public static ReceivedDeletedBlockInfo convert(
ReceivedDeletedBlockInfoProto proto) {
ReceivedDeletedBlockInfo.BlockStatus status = null;
switch (proto.getStatus()) {
case RECEIVING:
status = BlockStatus.RECEIVING_BLOCK;
break;View on GitHub (pinned to 2add963021)
Solutions
- Read the bad status value from the exception message and identify which node produced it.
- Align NameNode and Datanode software versions (finish or revert the rolling upgrade).
- If custom code builds ReceivedDeletedBlockInfo, restrict status to the three known values.
- Upgrade the parsing side to a release that knows the new enum constant.
Example fix
// before
ReceivedDeletedBlockInfo rdbi = new ReceivedDeletedBlockInfo(block, myStatus, hint);
proto = PBHelper.convert(rdbi); // myStatus may be unknown
// after
Set<ReceivedDeletedBlockInfo.BlockStatus> known = EnumSet.of(
RECEIVING_BLOCK, RECEIVED_BLOCK, DELETED_BLOCK);
if (!known.contains(myStatus)) {
throw new IllegalArgumentException("unsupported status: " + myStatus);
} Defensive patterns
Strategy: validation
Validate before calling
import org.apache.hadoop.hdfs.server.protocol.ReceivedDeletedBlockInfo;
import java.util.EnumSet;
EnumSet<ReceivedDeletedBlockInfo.BlockStatus> known = EnumSet.of(
ReceivedDeletedBlockInfo.BlockStatus.RECEIVING_BLOCK,
ReceivedDeletedBlockInfo.BlockStatus.RECEIVED_BLOCK,
ReceivedDeletedBlockInfo.BlockStatus.DELETED_BLOCK);
if (!known.contains(rdbi.getStatus())) {
throw new IllegalArgumentException("Unsupported block status: " + rdbi.getStatus());
}
// safe to convert
proto = PBHelper.convert(rdbi); Type guard
static boolean isKnownBlockStatus(ReceivedDeletedBlockInfo rdbi) {
switch (rdbi.getStatus()) {
case RECEIVING_BLOCK:
case RECEIVED_BLOCK:
case DELETED_BLOCK:
return true;
default:
return false;
}
} Try / catch
try {
builder.setStatus(PBHelper.convert(rdbi));
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Bad status:")) {
// unknown enum from a newer peer: quarantine the entry, alert on version skew
LOG.warn("Dropping block report entry with unknown status: {}", rdbi.getStatus());
return;
}
throw e;
} Prevention
- During rolling upgrades, drain old datanodes before adding new ones to block-report paths.
- Monitor for IllegalArgumentException with 'Bad status' as an early version-skew detector.
- Constrain custom code that constructs ReceivedDeletedBlockInfo to the three documented statuses.
When it happens
Trigger: receivedDeletedBlockInfo.getStatus() returns a value other than RECEIVING_BLOCK, RECEIVED_BLOCK, DELETED_BLOCK — typically a status constant added in a newer Hadoop release being serialized by an older PBHelper, or custom code constructing ReceivedDeletedBlockInfo with an out-of-range status.
Common situations: Version skew during rolling upgrades between NN and DN block-report handling; custom datanode instrumentation that alters status; corrupted in-memory enum (rare).
Related errors
- Unexpected HAServiceStateProto:
- Unexpected HAServiceState:
- Can't read FileStatusProto with negative size of ${size}
- Invalid size: {size}
- Cannot wrap ${class}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/f891c147c0da279f.
Report an issue: GitHub.