{"record":{"id":"cd59ae8944868f28","repo":"apache/hadoop","slug":"storage-type-is-not-available-available-storag","errorCode":null,"errorMessage":"Storage type {} is not available. Available storage types are {}","messagePattern":"Storage type (.+?) is not available\\. Available storage types are (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java","lineNumber":335,"sourceCode":"    \n    /** Constructor */\n    SetSpaceQuotaCommand(String[] args, int pos, Configuration conf) {\n      super(conf);\n      CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE);\n      List<String> parameters = c.parse(args, pos);\n      String str = parameters.remove(0).trim();\n      try {\n        quota = StringUtils.TraditionalBinaryPrefix.string2long(str);\n      } catch (NumberFormatException nfe) {\n        throw new IllegalArgumentException(\"\\\"\" + str + \"\\\" is not a valid value for a quota.\");\n      }\n      String storageTypeString =\n          StringUtils.popOptionWithArgument(\"-storageType\", parameters);\n      if (storageTypeString != null) {\n        try {\n          this.type = StorageType.parseStorageType(storageTypeString);\n        } catch (IllegalArgumentException e) {\n          throw new IllegalArgumentException(\"Storage type \"\n              + storageTypeString\n              + \" is not available. Available storage types are \"\n              + StorageType.getTypesSupportingQuota());\n        }\n      }\n      this.args = parameters.toArray(new String[parameters.size()]);\n    }\n    \n    /** Check if a command is the setQuota command\n     * \n     * @param cmd A string representation of a command starting with \"-\"\n     * @return true if this is a count command; false otherwise\n     */\n    public static boolean matches(String cmd) {\n      return (\"-\"+NAME).equals(cmd); \n    }\n\n    @Override","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L317-L353","documentation":"Thrown while parsing -storageType for `hdfs dfsadmin -setSpaceQuota`. StorageType.parseStorageType uppercases the input and calls valueOf, so any string that is not a StorageType enum name (typo, empty, 'MEMORY') throws IllegalArgumentException, which DFSAdmin rethrows as 'Storage type <s> is not available. Available storage types are <list>' where the list is StorageType.getTypesSupportingQuota() — the non-transient types DISK, SSD, ARCHIVE (RAM_DISK is transient and excluded).","triggerScenarios":"hdfs dfsadmin -setSpaceQuota 1t /data -storageType disks (typo); -storageType MEMORY (legacy name); -storageType \"\" from an unset shell variable. Lowercase 'disk' itself is fine because parsing uppercases; only genuinely unknown names fail.","commonSituations":"Docs or wikis using informal storage names; scripts wiring an empty variable when the option is optional; operators carrying over pre-2.x 'MEMORY' terminology; values copied from a different storage system's CLI.","solutions":["Use an exact StorageType name: DISK, SSD, or ARCHIVE (these are also the only quota-supporting types)","Print the valid set for your version: StorageType.getTypesSupportingQuota() or the Hadoop storage types doc","Default the variable and skip -storageType entirely when it is empty (omitting it sets plain space quota)","Namespace quota does not need -storageType at all — use hdfs dfsadmin -setQuota <n> <path>"],"exampleFix":"# before\n$ hdfs dfsadmin -setSpaceQuota 1t /data -storageType diskk\n# IllegalArgumentException: Storage type diskk is not available. Available storage types are [DISK, SSD, ARCHIVE]\n\n# after\n$ hdfs dfsadmin -setSpaceQuota 1t /data -storageType SSD","handlingStrategy":"validation","validationCode":"static final Set<String> QUOTA_STORAGE_TYPES = Set.of(\"DISK\", \"SSD\", \"ARCHIVE\");\n\nstatic void validateStorageType(String s) {\n  if (s == null || !QUOTA_STORAGE_TYPES.contains(s.toUpperCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(\"storage type must be one of \" + QUOTA_STORAGE_TYPES);\n  }\n}","typeGuard":"static boolean isQuotaStorageType(String s) {\n  return s != null && QUOTA_STORAGE_TYPES.contains(s.toUpperCase(Locale.ROOT));\n}","tryCatchPattern":null,"preventionTips":["Whitelist DISK/SSD/ARCHIVE in wrapper scripts before invoking dfsadmin","Skip -storageType entirely when the variable is empty — omitting sets plain space quota","RAM_DISK is transient and never supports quotas; MEMORY is not a valid name"],"tags":["hdfs","dfsadmin","storage-type","quota","cli","argument-parsing"],"backgroundTag":"invalid-enum-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}