{"record":{"id":"36fc2fb60dc76bbb","repo":"apache/hadoop","slug":"no-attribute-for-symbol","errorCode":null,"errorMessage":"No attribute for \" + symbol","messagePattern":"No attribute for \" \\+ symbol","errorType":"validation","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpOptions.java","lineNumber":190,"sourceCode":"  public enum FileAttribute {\n    REPLICATION,    // R\n    BLOCKSIZE,      // B\n    USER,           // U\n    GROUP,          // G\n    PERMISSION,     // P\n    CHECKSUMTYPE,   // C\n    ACL,            // A\n    XATTR,          // X\n    TIMES,          // T\n    ERASURECODINGPOLICY; // E\n\n    public static FileAttribute getAttribute(char symbol) {\n      for (FileAttribute attribute : values()) {\n        if (attribute.name().charAt(0) == Character.toUpperCase(symbol)) {\n          return attribute;\n        }\n      }\n      throw new NoSuchElementException(\"No attribute for \" + symbol);\n    }\n  }\n\n  private DistCpOptions(Builder builder) {\n    this.sourceFileListing = builder.sourceFileListing;\n    this.sourcePaths = builder.sourcePaths;\n    this.targetPath = builder.targetPath;\n\n    this.atomicCommit = builder.atomicCommit;\n    this.atomicWorkPath = builder.atomicWorkPath;\n    this.syncFolder = builder.syncFolder;\n    this.deleteMissing = builder.deleteMissing;\n    this.ignoreFailures = builder.ignoreFailures;\n    this.overwrite = builder.overwrite;\n    this.append = builder.append;\n    this.skipCRC = builder.skipCRC;\n    this.blocking = builder.blocking;\n","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpOptions.java#L172-L208","documentation":"DistCpOptions.FileAttribute.getAttribute maps each letter of the -p value to an enum constant by first letter, case-insensitively: r=REPLICATION, b=BLOCKSIZE, u=USER, g=GROUP, p=PERMISSION, c=CHECKSUMTYPE, a=ACL, x=XATTR, t=TIMES, e=ERASURECODINGPOLICY. A letter with no matching constant throws NoSuchElementException('No attribute for <symbol>') while parsing options. An empty -p value is valid and preserves everything.","triggerScenarios":"hadoop distcp -p rq ... ('q' matches nothing); word-style values like -p all ('a' is valid for ACL but 'l' and any remaining letters are not); a stray character or space inside the -p value.","commonSituations":"Typos in hand-written commands; assuming 'a' means 'all' when it means ACL, or copying rsync-style flags; option strings pasted between tools with different vocabularies.","solutions":["Use only valid letters, e.g. -p rb (replication+blocksize) or -p rbugp","For 'preserve everything', pass bare -p with no value (empty means all attributes)","Check the -p argument for stray characters or embedded spaces"],"exampleFix":"# before\nhadoop distcp -p all hdfs://src hdfs://dst\n# -> NoSuchElementException: No attribute for l\n\n# after: bare -p preserves all attributes\nhadoop distcp -p hdfs://src hdfs://dst","handlingStrategy":"validation","validationCode":"private static final String VALID_ATTRS = \"rbugpcaxte\";\n\nstatic boolean isValidPreserveValue(String v) {\n  // empty means \"preserve all\" and is valid\n  return v == null || v.isEmpty()\n      || v.chars().allMatch(c -> VALID_ATTRS.indexOf(c) >= 0);\n}\n\nif (!isValidPreserveValue(pValue)) {\n  throw new IllegalArgumentException(\n      \"invalid -p value '\" + pValue + \"'; valid letters: \" + VALID_ATTRS\n      + \" (or bare -p for all)\");\n}","typeGuard":"static boolean isFileAttributeSymbol(char c) {\n  return \"rbugpcaxte\".indexOf(Character.toLowerCase(c)) >= 0;\n}","tryCatchPattern":null,"preventionTips":["Validate -p values in job-launch scripts against the fixed letter set rbugpcaxte","Use bare -p for preserve-all instead of word values like 'all'","Keep a canonical distcp options reference next to launch scripts to avoid flag drift between tools"],"tags":["distcp","options","argument-parsing","preserve-attributes"],"backgroundTag":"invalid-option-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}