{"record":{"id":"95624892e76e9887","repo":"apache/hadoop","slug":"chmod-mode-modestr-does-not-match-the","errorCode":null,"errorMessage":"chmod : mode '\" + modeStr + \"' does not match the expected pattern.","messagePattern":"chmod : mode '\" \\+ modeStr \\+ \"' does not match the expected pattern\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShellPermissions.java","lineNumber":93,"sourceCode":"      \"mode, e.g. 754 is same as u=rwx,g=rx,o=r.\\n\\n\" +\n      \"If none of 'augo' is specified, 'a' is assumed and unlike the \" +\n      \"shell command, no umask is applied.\";\n\n    protected ChmodParser pp;\n\n    @Override\n    protected void processOptions(LinkedList<String> args) throws IOException {\n      CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, \"R\", null);\n      cf.parse(args);\n      setRecursive(cf.getOpt(\"R\"));\n\n      String modeStr = args.removeFirst();\n      try {\n        pp = new ChmodParser(modeStr);\n      } catch (IllegalArgumentException iea) {\n        // TODO: remove \"chmod : \" so it's not doubled up in output, but it's\n        // here for backwards compatibility...\n        throw new IllegalArgumentException(\n            \"chmod : mode '\" + modeStr + \"' does not match the expected pattern.\");      \n      }\n    }\n    \n    @Override\n    protected void processPath(PathData item) throws IOException {\n      short newperms = pp.applyNewPermission(item.stat);\n      if (item.stat.getPermission().toShort() != newperms) {\n        try {\n          item.fs.setPermission(item.path, new FsPermission(newperms));\n        } catch (IOException e) {\n          LOG.debug(\"Error changing permissions of \" + item, e);\n          throw new IOException(\n              \"changing permissions of '\" + item + \"': \" + e.getMessage());\n        }\n      }\n    }    \n  }","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShellPermissions.java#L75-L111","documentation":"Error \"chmod : mode '\" + modeStr + \"' does not match the expected pattern.\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FsShellPermissions.java:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an octal mode like 755 or a symbolic mode like u+rwx matching chmod syntax.","Quote the mode argument to prevent shell mangling."],"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"}