apache/hadoop · error · IOException

EC policy '%s' specified at %s is not a valid policy. Please

Error message

EC policy '%s' specified at %s is not a valid policy. Please choose from list of available policies: [%s]

What it means

Error "EC policy '%s' specified at %s is not a valid policy. Please choose from list of available policies: [%s]" thrown in apache/hadoop.

Source

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

  private void enableDefaultPolicy(Configuration conf) throws IOException {
    defaultPolicyName = conf.getTrimmed(
        DFSConfigKeys.DFS_NAMENODE_EC_SYSTEM_DEFAULT_POLICY,
        DFSConfigKeys.DFS_NAMENODE_EC_SYSTEM_DEFAULT_POLICY_DEFAULT);
    if (!defaultPolicyName.isEmpty()) {
      final ErasureCodingPolicyInfo info =
          policiesByName.get(defaultPolicyName);
      if (info == null) {
        String names = policiesByName.values()
            .stream().map((pi) -> pi.getPolicy().getName())
            .collect(Collectors.joining(", "));
        String msg = String.format("EC policy '%s' specified at %s is not a "
                + "valid policy. Please choose from list of available "
                + "policies: [%s]",
            defaultPolicyName,
            DFSConfigKeys.DFS_NAMENODE_EC_SYSTEM_DEFAULT_POLICY,
            names);
        throw new IOException(msg);
      }
      info.setState(ErasureCodingPolicyState.ENABLED);
      enabledPoliciesByName.put(info.getPolicy().getName(), info.getPolicy());
    }
  }

  private void updatePolicies() {
    enabledPolicies =
        enabledPoliciesByName.values().toArray(new ErasureCodingPolicy[0]);
    allPolicies =
        policiesByName.values().toArray(new ErasureCodingPolicyInfo[0]);
  }

  public String getEnabledPoliciesMetric() {
    return StringUtils.join(", ",
            enabledPoliciesByName.keySet());
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Choose one of the listed available EC policies.
  2. Enable the desired policy with 'hdfs ec -enablePolicy -policy <name>' before using it.

When it happens

Trigger: Unsetting an erasure coding policy on a directory whose explicitly set policy name does not match any known policy (typically after downgrade or policy removal).

Common situations: See trigger scenarios.


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