{"record":{"id":"700141d14644db3e","repo":"apache/hadoop","slug":"cannot-find-srciip-getpath","errorCode":null,"errorMessage":"\"cannot find \" + srcIIP.getPath()","messagePattern":"\"cannot find \" \\+ srcIIP\\.getPath\\(\\)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EncryptionZoneManager.java","lineNumber":542,"sourceCode":"      sb.append(getFullPathName(zoneId));\n      sb.append(\" is currently under re-encryption\");\n      throw new IOException(sb.toString());\n    }\n  }\n\n  /**\n   * Create a new encryption zone.\n   * <p>\n   * Called while holding the FSDirectory lock.\n   */\n  XAttr createEncryptionZone(INodesInPath srcIIP, CipherSuite suite,\n      CryptoProtocolVersion version, String keyName)\n      throws IOException {\n    assert dir.hasWriteLock();\n\n    // Check if src is a valid path for new EZ creation\n    if (srcIIP.getLastINode() == null) {\n      throw new FileNotFoundException(\"cannot find \" + srcIIP.getPath());\n    }\n\n    INode srcINode = srcIIP.getLastINode();\n    if (!srcINode.isDirectory()) {\n      throw new IOException(\"Attempt to create an encryption zone for a file.\");\n    }\n\n    if (hasCreatedEncryptionZone() && encryptionZones.\n        get(srcINode.getId()) != null) {\n      throw new IOException(\n          \"Directory \" + srcIIP.getPath() + \" is already an encryption zone.\");\n    }\n\n    if (dir.isNonEmptyDirectory(srcIIP)) {\n      throw new IOException(\n          \"Attempt to create an encryption zone for a non-empty directory.\");\n    }\n    final HdfsProtos.ZoneEncryptionInfoProto proto =","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/EncryptionZoneManager.java#L524-L560","documentation":"FileNotFoundException('cannot find <path>') from EncryptionZoneManager.createEncryptionZone: the INodesInPath resolved for the createZone request has no last inode, i.e., the path does not exist in the namespace. The zone target must be an existing directory before it can be marked as an encryption zone.","triggerScenarios":"hdfs crypto -createZone -keyName <key> <path> (or the equivalent createEncryptionZone API) where <path> was never created, has a typo, or a parent component is missing.","commonSituations":"Automation/provisioning scripts that call createZone before mkdir; typos in long paths; races where the mkdir step failed earlier in the script.","solutions":["Create the directory first: hdfs dfs -mkdir -p <path>, then hdfs crypto -createZone -keyName <key> <path>.","Fix the typo/verify existence with hdfs dfs -test -d <path> before creating the zone.","In provisioning code, make zone creation idempotent: check existence and zone status first."],"exampleFix":"# before\nhdfs crypto -createZone -keyName mykey /projets/secure   # typo, path missing\n# after\nhdfs dfs -mkdir -p /projects/secure\nhdfs crypto -createZone -keyName mykey /projects/secure","handlingStrategy":"validation","validationCode":"if (!fs.exists(zonePath)) {\n  fs.mkdirs(zonePath);              // zone target must exist first\n}\nhdfs crypto -createZone -keyName key zonePath","typeGuard":null,"tryCatchPattern":"try {\n  dfs.createEncryptionZone(dir, key);\n} catch (RemoteException re) {\n  IOException e = re.unwrapRemoteException(FileNotFoundException.class);\n  // create the directory (mkdirs) and retry once\n}","preventionTips":["Always mkdir -p before hdfs crypto -createZone in scripts.","Verify paths with hdfs dfs -test -d during provisioning.","Make zone provisioning idempotent: exists() check + zone-membership check + create."],"tags":["hdfs","encryption-zone","file-not-found","provisioning"],"backgroundTag":"path-not-found","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}