{"record":{"id":"fe698ff310385840","repo":"apache/hadoop","slug":"input-output-error-fe698f","errorCode":null,"errorMessage":"Input/output error","messagePattern":"Input/output error","errorType":"exception","errorClass":"PathIOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java","lineNumber":88,"sourceCode":"  protected void processNonexistentPath(PathData item) throws IOException {\n    if (!createParents) {\n      // check if parent exists. this is complicated because getParent(a/b/c/) returns a/b/c, but\n      // we want a/b\n      final Path itemPath = new Path(item.path.toString());\n      final Path itemParentPath = itemPath.getParent();\n\n      if(itemParentPath == null) {\n        throw new PathNotFoundException(String.format(\n            \"Item: %s parent's path is null. This can happen if mkdir is \" +\n                \"called on root, so there's no parent.\", itemPath.toString()));\n      }\n\n      if (!item.fs.exists(itemParentPath)) {\n        throw new PathNotFoundException(itemParentPath.toString());\n      }\n    }\n    if (!item.fs.mkdirs(item.path)) {\n      throw new PathIOException(item.toString());\n    }\n  }\n}\n","sourceCodeStart":70,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Mkdir.java#L70-L92","documentation":"Thrown by Mkdir.processNonexistentPath (Mkdir.java:88) when FileSystem.mkdirs(path) returns false instead of throwing. PathIOException's default message is 'Input/output error'. A false return means the filesystem declined the creation without an exception, so the shell cannot report the real cause (contrast the comment in Rename: 'we have no way to know the actual error...').","triggerScenarios":"item.fs.mkdirs(item.path) returning false: no write permission on the parent directory in some FileSystem implementations, the parent being deleted concurrently between the exists() check and mkdirs(), a file appearing at the same path, or filesystem-specific failures (quota, namespace limits) surfaced as false rather than IOException.","commonSituations":"HDFS permissions where the invoking user lacks WRITE on the parent; concurrent jobs creating/deleting the same tree; small quotas (namespace quota exceeded surfaces differently across versions); hitting this with -p where the parent check is skipped but the FS still refuses creation.","solutions":["Verify write permission on the parent directory ('hadoop fs -ls <parent>') and fix ownership/permissions or run as the right user","Check NameNode logs for the real reason (quota exceeded, lease, safe mode) since the shell error carries no detail","Confirm the path is not occupied by a file: 'hadoop fs -ls <path>'","Retry after the transient condition (safe mode exit, concurrent job finishing) is resolved"],"exampleFix":"# diagnose: the shell gives no detail, so ask the FS directly\nhadoop fs -ls /data        # check parent perms\nhdfs dfsadmin -safemode get # check safe mode\nhdfs dfsadmin -setQuota /data 100000   # if namespace quota was hit","handlingStrategy":"try-catch","validationCode":"// pre-flight: permission + path state\nif (!fs.exists(parent) || fs.getFileStatus(parent).isDirectory() == false) throw new IllegalStateException(\"bad parent\");","typeGuard":null,"tryCatchPattern":"catch (PathIOException e) { log path + inspect NN logs for the real cause (perms/quota/safe mode); resolve root cause before retrying; do not blind-retry in a tight loop }","preventionTips":["Grant WRITE on the parent directory to the invoking user","Watch namespace quotas on target directories","Avoid concurrent create/delete of the same tree"],"tags":["hdfs","mkdir","io-error","permissions","hadoop-shell"],"backgroundTag":"filesystem-op-returned-false","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}