apache/hadoop · error · IOException

Cannot get locations to create {}

Error message

Cannot get locations to create {}

What it means

Error "Cannot get locations to create {}" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java:1145

    }
    return getCreateLocation(src, locations);
  }

  /**
   * Get the location to create a file. It checks if the file already existed
   * in one of the locations.
   *
   * @param src Path of the file to check.
   * @param locations Prefetched locations for the file.
   * @return The remote location for this file.
   * @throws IOException If the file has no creation location.
   */
  RemoteLocation getCreateLocation(
      final String src, final List<RemoteLocation> locations)
      throws IOException {

    if (locations == null || locations.isEmpty()) {
      throw new IOException("Cannot get locations to create " + src);
    }

    RemoteLocation createLocation = locations.get(0);
    if (locations.size() > 1) {
      try {
        RemoteLocation existingLocation = getExistingLocation(src, locations);
        // Forward to the existing location and let the NN handle the error
        if (existingLocation != null) {
          LOG.debug("{} already exists in {}.", src, existingLocation);
          createLocation = existingLocation;
        }
      } catch (FileNotFoundException fne) {
        // Ignore if the file is not found
      }
    }
    return createLocation;
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Check the mount table for the parent path; the create must resolve to at least one destination nameservice.
  2. Verify destination nameservices have active namenodes registered.
  3. Add a mount entry covering the path if resolution falls back to nothing.

When it happens

Trigger: RouterRpcServer could not resolve remote locations while handling a create call.

Common situations: Creating a file under a path with no matching mount entry and no usable default nameservice.


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