apache/hadoop · error · IllegalArgumentException

%s is not available

Error message

%s is not available

What it means

DNSOperationsFactory.createInstance(name, impl, conf) maps a DNSImplementation enum to a backing implementation. Only DNSJAVA is wired (new RegistryDNS(name)); every other value falls into the default branch and throws IllegalArgumentException('<impl> is not available').

Source

Thrown at hadoop-common-project/hadoop-registry/src/main/java/org/apache/hadoop/registry/client/api/DNSOperationsFactory.java:70

   * Access rights will be determined from the configuration.
   *
   * @param name name of the instance
   * @param impl the DNS implementation.
   * @param conf configuration
   * @return a registry operations instance
   */
  public static DNSOperations createInstance(String name,
      DNSImplementation impl,
      Configuration conf) {
    Preconditions.checkArgument(conf != null, "Null configuration");
    DNSOperations operations = null;
    switch (impl) {
    case DNSJAVA:
      operations = new RegistryDNS(name);
      break;

    default:
      throw new IllegalArgumentException(
          String.format("%s is not available", impl.toString()));
    }

    //operations.init(conf);
    return operations;
  }

}

View on GitHub (pinned to 2add963021)

Solutions

  1. Pass DNSImplementation.DNSJAVA — the only supported implementation today
  2. When adding a DNSImplementation constant, add its case to this switch in the same change
  3. If the value comes from configuration, whitelist 'DNSJAVA' and fail with a clear message on anything else

Example fix

// before
DNSOperations ops = DNSOperationsFactory.createInstance(name, parsedImpl, conf); // parsedImpl != DNSJAVA

// after
DNSOperations ops = DNSOperationsFactory.createInstance(name, DNSImplementation.DNSJAVA, conf);
Defensive patterns

Strategy: validation

Validate before calling

Preconditions.checkArgument(impl == DNSImplementation.DNSJAVA,
    "Only DNSJAVA DNS implementation is supported");
DNSOperations ops = DNSOperationsFactory.createInstance(name, impl, conf);

Prevention

When it happens

Trigger: Passing any DNSImplementation constant other than DNSJAVA — reachable when the enum grows new constants (or downstream code resolves the enum dynamically, e.g. DNSImplementation.valueOf(config)) and this factory has not been extended. A null conf fails earlier on the Preconditions check.

Common situations: Extending hadoop-registry with a new DNS backend enum constant but forgetting the factory switch case; resolving the implementation name from configuration with valueOf(); forks where the enum and factory diverge.

Related errors


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