apache/hadoop · error · IllegalArgumentException

Failed to parse "{str}" as a radix-{radix} short integer.

Error message

Failed to parse "{str}" as a radix-{radix} short integer.

What it means

ShortParam.Domain.parse (ShortParam.java:67-81) converts the query token with Short.parseShort(str, radix) after mapping 'null'/missing to null; NumberFormatException is rethrown as this IllegalArgumentException (HTTP 400). The built-in short parameters are permission-style values parsed in radix 8 and replication parsed in radix 10, so the usual cause is a digit invalid for the radix — most famously '9' in an octal permission — or a plainly non-numeric string.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/resources/ShortParam.java:78

    }

    Domain(final String paramName, final int radix) {
      super(paramName);
      this.radix = radix;
    }

    @Override
    public String getDomain() {
      return "<" + NULL + " | short in radix " + radix + ">";
    }

    @Override
    Short parse(final String str) {
      try {
        return NULL.equals(str) || str == null ? null : Short.parseShort(str,
          radix);
      } catch(NumberFormatException e) {
        throw new IllegalArgumentException("Failed to parse \"" + str
            + "\" as a radix-" + radix + " short integer.", e);
      }
    }

    /** Convert a Short to a String. */
    String toString(final Short n) {
      return n == null? NULL: Integer.toString(n, radix);
    }
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Send permission as octal digits 0-7 only, e.g. permission=644; replication as a decimal integer.
  2. Convert symbolic modes (rwxr--r--) to octal at your call site before building the URL.
  3. Omit the parameter or send literal 'null' to accept the server default.

Example fix

# before
curl -i -X PUT "http://nn:9870/webhdfs/v1/f?op=CREATE&permission=999"
# after
curl -i -X PUT "http://nn:9870/webhdfs/v1/f?op=CREATE&permission=644"
Defensive patterns

Strategy: validation

Validate before calling

static short parseOctal(String perm) {
  if (!perm.matches("[0-7]+")) throw new IllegalArgumentException("octal digits 0-7 only: " + perm);
  return (short) Integer.parseInt(perm, 8);
}

Type guard

static boolean isOctalString(String s) { return s != null && s.matches("[0-7]+"); }

Prevention

When it happens

Trigger: ?permission=999 or ?permission=0779 (9 is not an octal digit); ?permission=rwxr--r--; ?replication=1.5; ?replication=two; ?unmasked.permission=abc.

Common situations: Users assuming permission is decimal and sending 999; sending symbolic mode strings from shell scripts; float or word values for replication in generated URLs.

Understand the failure class

Related errors


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