apache/hadoop · error · IOException

Failed to %s since %s is set to false.

Error message

Failed to %s since %s is set to false.

What it means

All storage-policy RPCs (setStoragePolicy, unsetStoragePolicy, satisfyStoragePolicy and related wrappers) funnel through checkStoragePolicyEnabled. When the NameNode runs with dfs.storage.policy.enabled=false, the call is refused with IOException('Failed to <operation> since dfs.storage.policy.enabled is set to false.') before permission or superuser checks run.

Source

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

    if (success) {
      getEditLog().logSync();
      logAuditEvent(true, operationName, src);
    }
    return success;
  }

  /**
   * Verify storage policies are enabled and if only super user is allowed to
   * set storage policies.
   *
   * @param operationNameReadable Name of storage policy for exception text
   * @param checkSuperUser Whether to check for super user privilege
   * @throws IOException
   */
  private void checkStoragePolicyEnabled(final String operationNameReadable,
      boolean checkSuperUser) throws IOException {
    if (!isStoragePolicyEnabled) {
      throw new IOException(String.format(
          "Failed to %s since %s is set to false.", operationNameReadable,
          DFS_STORAGE_POLICY_ENABLED_KEY));
    }
    if (checkSuperUser && isStoragePolicySuperuserOnly) {
      checkSuperuserPrivilege(
          CaseUtils.toCamelCase(operationNameReadable, false));
    }
  }

  /**
   * Set the storage policy for a file or a directory.
   *
   * @param src file/directory path
   * @param policyName storage policy name
   * @throws  IOException
   */
  void setStoragePolicy(String src, String policyName) throws IOException {
    if (policyName.equalsIgnoreCase(

View on GitHub (pinned to 2add963021)

Solutions

  1. Set dfs.storage.policy.enabled=true in hdfs-site.xml on every NameNode (active and standbys) and restart/reapply the config
  2. Verify with a read (hdfs fsck -storagepolicies or getStoragePolicy) that policies work before bulk -setStoragePolicy runs
  3. If policies must stay disabled, tier data with explicit Mover workflows instead of storage policies

Example fix

<!-- hdfs-site.xml before -->
<property><name>dfs.storage.policy.enabled</name><value>false</value></property>
<!-- after: set on all NameNodes, then restart them -->
<property><name>dfs.storage.policy.enabled</name><value>true</value></property>
Defensive patterns

Strategy: validation

Validate before calling

if (!conf.getBoolean("dfs.storage.policy.enabled", true)) {
  throw new IllegalStateException("Storage policies disabled on this cluster (dfs.storage.policy.enabled=false)");
}

Try / catch

catch (IOException e) { if (e.getMessage() != null && e.getMessage().contains("dfs.storage.policy.enabled")) failWithConfigHint(); else throw e; }

Prevention

When it happens

Trigger: `hdfs dfsadmin -setStoragePolicy -path <p> -policy <pol>` (or -unsetStoragePolicy / -satisfyStoragePolicy, or the equivalent ClientProtocol calls) against a NameNode whose hdfs-site.xml sets dfs.storage.policy.enabled=false.

Common situations: Cluster hardened per guidance to disable storage policies when heterogeneous storage is unused; tiering/Mover workflows enabled later without flipping the flag back; rolling upgrade leaves one NameNode with the old value so calls fail intermittently depending on which NN serves them.

Related errors


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