{"record":{"id":"5f669c1a6fab9761","repo":"apache/hadoop","slug":"key-length-must-be-0","errorCode":null,"errorMessage":"key length must be > 0","messagePattern":"key length must be > 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/HashFunction.java","lineNumber":114,"sourceCode":"      throw new IllegalArgumentException(\"hashType must be known\");\n  }\n\n  /** Clears <i>this</i> hash function. A NOOP */\n  public void clear() {\n  }\n\n  /**\n   * Hashes a specified key into several integers.\n   * @param k The specified key.\n   * @return The array of hashed values.\n   */\n  public int[] hash(Key k){\n      byte[] b = k.getBytes();\n      if (b == null) {\n        throw new NullPointerException(\"buffer reference is null\");\n      }\n      if (b.length == 0) {\n        throw new IllegalArgumentException(\"key length must be > 0\");\n      }\n      int[] result = new int[nbHash];\n      for (int i = 0, initval = 0; i < nbHash; i++) {\n\t  initval = hashFunction.hash(b, initval);\n\t  result[i] = Math.abs(initval % maxValue);\n      }\n      return result;\n  }\n}","sourceCodeStart":96,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/HashFunction.java#L96-L123","documentation":"Error \"key length must be > 0\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/bloom/HashFunction.java:114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The key to hash is empty. Provide a key with length > 0 before calling hash()."],"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-23T01:17:44.959Z"}