apache/hadoop · error · PathNotFoundException

{}

Error message

{}

What it means

CuratorService.zkStat(path) runs curator.checkExists().forPath(fullpath); ZooKeeper's checkExists reports a missing node by returning a null Stat rather than raising an error, so the code converts the null into PathNotFoundException(path). fullpath is the argument after createFullPath() prepends the configured registry root, so the miss can come from a wrong root as well as a wrong path.

Source

Thrown at hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/impl/zk/CuratorService.java:491

   * @param path path of operation
   * @return a curator stat entry
   * @throws IOException           on a failure
   * @throws PathNotFoundException if the path was not found
   */
  public Stat zkStat(String path) throws IOException {
    checkServiceLive();
    String fullpath = createFullPath(path);
    Stat stat;
    try {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Stat {}", fullpath);
      }
      stat = curator.checkExists().forPath(fullpath);
    } catch (Exception e) {
      throw operationFailure(fullpath, "read()", e);
    }
    if (stat == null) {
      throw new PathNotFoundException(path);
    }
    return stat;
  }

  /**
   * Get the ACLs of a path.
   *
   * @param path path of operation
   * @return a possibly empty list of ACLs
   * @throws IOException
   */
  public List<ACL> zkGetACLS(String path) throws IOException {
    checkServiceLive();
    String fullpath = createFullPath(path);
    List<ACL> acls;
    try {
      if (LOG.isDebugEnabled()) {
        LOG.debug("GetACLS {}", fullpath);

View on GitHub (pinned to 2add963021)

Solutions

  1. Probe first with zkPathExists(path) (or RegistryOperations.exists) and treat false as 'not published'.
  2. Verify the exact path/root: compare against what bind()/mknode created, including the registry root prefix.
  3. Catch PathNotFoundException and handle it as the normal 'entry absent' outcome.

Example fix

// before
Stat stat = curatorService.zkStat("/services/api"); // node absent -> PathNotFoundException

// after
if (!curatorService.zkPathExists("/services/api")) {
  // not published yet: create it or report absence
}
Stat stat = curatorService.zkStat("/services/api");
Defensive patterns

Strategy: validation

Validate before calling

if (!curatorService.zkPathExists(path)) { // or registryOperations.exists(path)
  // entry not published (yet): create it or report absence instead of stat'ing
}
Stat stat = curatorService.zkStat(path);

Try / catch

try {
  Stat stat = curatorService.zkStat(path);
} catch (PathNotFoundException e) {
  // normal 'not published' outcome: skip, wait for registration, or create the node
}

Prevention

When it happens

Trigger: zkStat/stat on a znode that was never created or was already deleted; a path whose registry-root prefix is wrong so every lookup misses; stat'ing a service record before the publisher has created it.

Common situations: Resolving or stat'ing a service before it publishes; after unregister; typos in registry paths; registry root not initialized (mkroot never run) so lookups target a nonexistent subtree.

Related errors


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