{"record":{"id":"b580a20bb34ba850","repo":"apache/hadoop","slug":"addition-of-user-defined-erasure-coding-policy-is","errorCode":null,"errorMessage":"Addition of user defined erasure coding policy is disabled.","messagePattern":"Addition of user defined erasure coding policy is disabled\\.","errorType":"exception","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingPolicyManager.java","lineNumber":299,"sourceCode":"    return this.policiesByName.get(name);\n  }\n\n  /**\n   * Clear and clean up.\n   */\n  public void clear() {\n    // TODO: we should only clear policies loaded from NN metadata.\n    // This is a placeholder for HDFS-7337.\n  }\n\n  /**\n   * Add an erasure coding policy.\n   * @return the added policy\n   */\n  public synchronized ErasureCodingPolicy addPolicy(\n      ErasureCodingPolicy policy) {\n    if (!userDefinedAllowed) {\n      throw new HadoopIllegalArgumentException(\n          \"Addition of user defined erasure coding policy is disabled.\");\n    }\n\n    if (!CodecUtil.hasCodec(policy.getCodecName())) {\n      throw new HadoopIllegalArgumentException(\"Codec name \"\n          + policy.getCodecName() + \" is not supported\");\n    }\n\n    int blocksInGroup = policy.getNumDataUnits() + policy.getNumParityUnits();\n    if (blocksInGroup > HdfsServerConstants.MAX_BLOCKS_IN_GROUP) {\n      throw new HadoopIllegalArgumentException(\"Number of data and parity blocks in an EC group \" +\n          blocksInGroup + \" should not exceed maximum \" + HdfsServerConstants.MAX_BLOCKS_IN_GROUP);\n    }\n\n    if (policy.getCellSize() > maxCellSize) {\n      throw new HadoopIllegalArgumentException(\"Cell size \" +\n          policy.getCellSize() + \" should not exceed maximum \" +\n          maxCellSize + \" bytes\");","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ErasureCodingPolicyManager.java#L281-L317","documentation":"Error \"Addition of user defined erasure coding policy is disabled.\" thrown in apache/hadoop.","triggerScenarios":"addErasureCodingPolicy when user-defined EC policies are disabled (dfs.namenode.ec.policies.user-defined disabled).","commonSituations":"See trigger scenarios.","solutions":["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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}