{"record":{"id":"f786d5cc512cffdc","repo":"apache/hadoop","slug":"conf-is-not-set","errorCode":null,"errorMessage":"conf is not set","messagePattern":"conf is not set","errorType":"exception","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RPC.java","lineNumber":980,"sourceCode":"    }\n    \n    /**\n     * @return Default: null.\n     * @param alignmentContext input alignmentContext.\n     */\n    public Builder setAlignmentContext(AlignmentContext alignmentContext) {\n      this.alignmentContext = alignmentContext;\n      return this;\n    }\n\n    /**\n     * @return Build the RPC Server.\n     * @throws IOException on error\n     * @throws HadoopIllegalArgumentException when mandatory fields are not set\n     */\n    public Server build() throws IOException, HadoopIllegalArgumentException {\n      if (this.conf == null) {\n        throw new HadoopIllegalArgumentException(\"conf is not set\");\n      }\n      if (this.protocol == null) {\n        throw new HadoopIllegalArgumentException(\"protocol is not set\");\n      }\n      if (this.instance == null) {\n        throw new HadoopIllegalArgumentException(\"instance is not set\");\n      }\n      \n      return getProtocolEngine(this.protocol, this.conf).getServer(\n          this.protocol, this.instance, this.bindAddress, this.port,\n          this.numHandlers, this.numReaders, this.queueSizePerHandler,\n          this.verbose, this.conf, this.secretManager, this.portRangeConfig,\n          this.alignmentContext);\n    }\n  }\n  \n  /** An RPC Server. */\n  public abstract static class Server extends org.apache.hadoop.ipc.Server {","sourceCodeStart":962,"sourceCodeEnd":998,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/RPC.java#L962-L998","documentation":"RPC.Server.Builder.build() validates its mandatory fields and throws HadoopIllegalArgumentException(\"conf is not set\") when setConf was never called. The Configuration supplies bind behavior, secrets, and the protocol engine lookup (getProtocolEngine), so a Server cannot be constructed without it.","triggerScenarios":"Building an RPC server via new RPC.Server.Builder() without a .setConf(conf) call; passing a Configuration variable that was never initialized and is null.","commonSituations":"Hand-rolled test RPC servers; copy-pasted builder chains where the setConf line was dropped; refactors that moved Configuration creation after the build() call.","solutions":["Call builder.setConf(conf) with a non-null Configuration before build().","Verify the Configuration was actually constructed (new Configuration() or loaded from resources) and not left null.","Make setConf the first setter in the chain so later edits cannot silently drop it."],"exampleFix":"// before\nServer s = new RPC.Server.Builder()\n    .setProtocol(MyProto.class)\n    .setInstance(impl)\n    .build(); // throws: conf is not set\n// after\nServer s = new RPC.Server.Builder()\n    .setConf(conf)\n    .setProtocol(MyProto.class)\n    .setInstance(impl)\n    .build();","handlingStrategy":"validation","validationCode":"if (conf == null) {\n  throw new IllegalStateException(\"Configuration required before building RPC server\");\n}\nnew RPC.Server.Builder().setConf(conf)...build();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat setConf as the first mandatory call in every server builder chain.","Fail fast on null Configuration during component init rather than at build()."],"tags":["rpc","server","builder","configuration"],"backgroundTag":"missing-required-field","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}