{"record":{"id":"12e7162541ddd5cb","repo":"apache/hadoop","slug":"cannot-get-locations-to-create","errorCode":null,"errorMessage":"Cannot get locations to create {}","messagePattern":"Cannot get locations to create (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java","lineNumber":1145,"sourceCode":"    }\n    return getCreateLocation(src, locations);\n  }\n\n  /**\n   * Get the location to create a file. It checks if the file already existed\n   * in one of the locations.\n   *\n   * @param src Path of the file to check.\n   * @param locations Prefetched locations for the file.\n   * @return The remote location for this file.\n   * @throws IOException If the file has no creation location.\n   */\n  RemoteLocation getCreateLocation(\n      final String src, final List<RemoteLocation> locations)\n      throws IOException {\n\n    if (locations == null || locations.isEmpty()) {\n      throw new IOException(\"Cannot get locations to create \" + src);\n    }\n\n    RemoteLocation createLocation = locations.get(0);\n    if (locations.size() > 1) {\n      try {\n        RemoteLocation existingLocation = getExistingLocation(src, locations);\n        // Forward to the existing location and let the NN handle the error\n        if (existingLocation != null) {\n          LOG.debug(\"{} already exists in {}.\", src, existingLocation);\n          createLocation = existingLocation;\n        }\n      } catch (FileNotFoundException fne) {\n        // Ignore if the file is not found\n      }\n    }\n    return createLocation;\n  }\n","sourceCodeStart":1127,"sourceCodeEnd":1163,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/RouterRpcServer.java#L1127-L1163","documentation":"Error \"Cannot get locations to create {}\" thrown in apache/hadoop.","triggerScenarios":"RouterRpcServer could not resolve remote locations while handling a create call.","commonSituations":"Creating a file under a path with no matching mount entry and no usable default nameservice.","solutions":["Check the mount table for the parent path; the create must resolve to at least one destination nameservice.","Verify destination nameservices have active namenodes registered.","Add a mount entry covering the path if resolution falls back to nothing."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}