apache/hadoop · error · IllegalArgumentException

Invalid registration, no nameservice specified {}

Error message

Invalid registration, no nameservice specified {}

What it means

MembershipState.validate() (which also calls BaseRecord.validate()) enforces that a membership registration carries a nameservice id; a null or empty getNameserviceId() throws IllegalArgumentException(ERROR_MSG_NO_NS_SPECIFIED + this). Memberships are keyed by nameservice, so a record without one cannot be stored or resolved. The record itself is appended to the message, showing exactly what was registered.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/store/records/MembershipState.java:246

  /**
   * Check if the namenode is available.
   *
   * @return If the namenode is available.
   */
  public boolean isAvailable() {
    return getState() == ACTIVE;
  }

  /**
   * Validates the entry. Throws an IllegalArgementException if the data record
   * is missing required information.
   */
  @Override
  public void validate() {
    super.validate();
    if (getNameserviceId() == null || getNameserviceId().length() == 0) {
      throw new IllegalArgumentException(
          ERROR_MSG_NO_NS_SPECIFIED + this);
    }
    if (getWebAddress() == null || getWebAddress().length() == 0) {
      throw new IllegalArgumentException(
          ERROR_MSG_NO_WEB_ADDR_SPECIFIED + this);
    }
    if (getRpcAddress() == null || getRpcAddress().length() == 0) {
      throw new IllegalArgumentException(
          ERROR_MSG_NO_RPC_ADDR_SPECIFIED + this);
    }
    if (!isBadState() &&
        (getBlockPoolId().isEmpty() || getBlockPoolId().length() == 0)) {
      throw new IllegalArgumentException(
          ERROR_MSG_NO_BP_SPECIFIED + this);
    }
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. If building MembershipState in code, set the nameservice id (plus rpc/web/block-pool fields) before put: record.setNameserviceId(nsId).
  2. For real registrations, check the Namenode-side federation config: dfs.nameservices / federation resolver settings must give every NN a nameservice.
  3. Inspect the record dump in the message — it shows the actual field values that were missing.
  4. Remove malformed rows from the state store so clean heartbeats regenerate them.

Example fix

// before
MembershipState m = MembershipState.newInstance();
m.setRpcAddress("nn1:8020");
store.put(m); // throws: no nameservice specified

// after: full registration record
MembershipState m = MembershipState.newInstance();
m.setNameserviceId("ns1");
m.setNamenodeId("nn1");
m.setRpcAddress("nn1:8020");
m.setWebAddress("nn1:9870");
m.setBlockPoolId("BP-1234");
store.put(m);
Defensive patterns

Strategy: validation

Validate before calling

// Validate registration completeness before storing
MembershipState m = MembershipState.newInstance();
m.setNameserviceId(nsId);
if (m.getNameserviceId() == null || m.getNameserviceId().isEmpty()) {
  throw new IllegalArgumentException("nameservice required before put()");
}

Type guard

boolean isCompleteMembership(MembershipState m) {
  return m.getNameserviceId() != null && !m.getNameserviceId().isEmpty()
      && m.getRpcAddress() != null && !m.getRpcAddress().isEmpty()
      && m.getWebAddress() != null && !m.getWebAddress().isEmpty()
      && m.getBlockPoolId() != null && !m.getBlockPoolId().isEmpty();
}

Try / catch

try {
  store.put(membership);
} catch (IllegalArgumentException e) {
  if (e.getMessage().contains("no nameservice specified")) {
    // registration source is broken: fix the heartbeat/resolver, don't retry the same record
    throw new IllegalStateException("Incomplete registration: " + e.getMessage(), e);
  }
  throw e;
}

Prevention

When it happens

Trigger: A Namenode registration/heartbeat or a programmatic store.put of a MembershipState where the nameservice id was never set: resolver submitted a registration with blank nsId; test/tooling code built MembershipState.newInstance() and skipped setNameserviceId before validate/put.

Common situations: Custom federation tooling or tests constructing membership records directly; a heartbeat from a NN whose federation configuration lacks the nameservice mapping; state store migration inserting rows without the nsId column.

Related errors


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