apache/hadoop · error · IllegalArgumentException

Storage type {} is not available. Available storage types ar

Error message

Storage type {} is not available. Available storage types are {}

What it means

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).

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java:335

    
    /** Constructor */
    SetSpaceQuotaCommand(String[] args, int pos, Configuration conf) {
      super(conf);
      CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE);
      List<String> parameters = c.parse(args, pos);
      String str = parameters.remove(0).trim();
      try {
        quota = StringUtils.TraditionalBinaryPrefix.string2long(str);
      } catch (NumberFormatException nfe) {
        throw new IllegalArgumentException("\"" + str + "\" is not a valid value for a quota.");
      }
      String storageTypeString =
          StringUtils.popOptionWithArgument("-storageType", parameters);
      if (storageTypeString != null) {
        try {
          this.type = StorageType.parseStorageType(storageTypeString);
        } catch (IllegalArgumentException e) {
          throw new IllegalArgumentException("Storage type "
              + storageTypeString
              + " is not available. Available storage types are "
              + StorageType.getTypesSupportingQuota());
        }
      }
      this.args = parameters.toArray(new String[parameters.size()]);
    }
    
    /** Check if a command is the setQuota command
     * 
     * @param cmd A string representation of a command starting with "-"
     * @return true if this is a count command; false otherwise
     */
    public static boolean matches(String cmd) {
      return ("-"+NAME).equals(cmd); 
    }

    @Override

View on GitHub (pinned to 2add963021)

Solutions

  1. Use an exact StorageType name: DISK, SSD, or ARCHIVE (these are also the only quota-supporting types)
  2. Print the valid set for your version: StorageType.getTypesSupportingQuota() or the Hadoop storage types doc
  3. Default the variable and skip -storageType entirely when it is empty (omitting it sets plain space quota)
  4. Namespace quota does not need -storageType at all — use hdfs dfsadmin -setQuota <n> <path>

Example fix

# before
$ hdfs dfsadmin -setSpaceQuota 1t /data -storageType diskk
# IllegalArgumentException: Storage type diskk is not available. Available storage types are [DISK, SSD, ARCHIVE]

# after
$ hdfs dfsadmin -setSpaceQuota 1t /data -storageType SSD
Defensive patterns

Strategy: validation

Validate before calling

static final Set<String> QUOTA_STORAGE_TYPES = Set.of("DISK", "SSD", "ARCHIVE");

static void validateStorageType(String s) {
  if (s == null || !QUOTA_STORAGE_TYPES.contains(s.toUpperCase(Locale.ROOT))) {
    throw new IllegalArgumentException("storage type must be one of " + QUOTA_STORAGE_TYPES);
  }
}

Type guard

static boolean isQuotaStorageType(String s) {
  return s != null && QUOTA_STORAGE_TYPES.contains(s.toUpperCase(Locale.ROOT));
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/cd59ae8944868f28. Report an issue: GitHub.