apache/hadoop · error · HadoopIllegalArgumentException

Addition of user defined erasure coding policy is disabled.

Error message

Addition of user defined erasure coding policy is disabled.

What it means

Policy-golicy guard in ErasureCodingPolicyManager.addPolicy: user-defined EC policy registration is disabled on this namespace (userDefinedAllowed false), so no custom policy can be added at runtime.

Solutions

  1. Enable user-defined erasure coding policies by setting dfs.namenode.ec.userDefinedPolicy.enabled (or the equivalent config) to true, or use a built-in EC policy.
Defensive patterns

Strategy: validation

When it happens

Trigger: addErasureCodingPolicy when user-defined EC policies are disabled (dfs.namenode.ec.policies.user-defined disabled).

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingPolicyManager.java:299

    return this.policiesByName.get(name);
  }

  /**
   * Clear and clean up.
   */
  public void clear() {
    // TODO: we should only clear policies loaded from NN metadata.
    // This is a placeholder for HDFS-7337.
  }

  /**
   * Add an erasure coding policy.
   * @return the added policy
   */
  public synchronized ErasureCodingPolicy addPolicy(
      ErasureCodingPolicy policy) {
    if (!userDefinedAllowed) {
      throw new HadoopIllegalArgumentException(
          "Addition of user defined erasure coding policy is disabled.");
    }

    if (!CodecUtil.hasCodec(policy.getCodecName())) {
      throw new HadoopIllegalArgumentException("Codec name "
          + policy.getCodecName() + " is not supported");
    }

    int blocksInGroup = policy.getNumDataUnits() + policy.getNumParityUnits();
    if (blocksInGroup > HdfsServerConstants.MAX_BLOCKS_IN_GROUP) {
      throw new HadoopIllegalArgumentException("Number of data and parity blocks in an EC group " +
          blocksInGroup + " should not exceed maximum " + HdfsServerConstants.MAX_BLOCKS_IN_GROUP);
    }

    if (policy.getCellSize() > maxCellSize) {
      throw new HadoopIllegalArgumentException("Cell size " +
          policy.getCellSize() + " should not exceed maximum " +
          maxCellSize + " bytes");

View on GitHub (pinned to 2add963021)