{"record":{"id":"ac52ccabcd6739f6","repo":"apache/hadoop","slug":"configured-mapreduce-local-reduce-tasks-maximum-mu","errorCode":null,"errorMessage":"Configured mapreduce.local.reduce.tasks.maximum must be >= 1","messagePattern":"Configured mapreduce\\.local\\.reduce\\.tasks\\.maximum must be >= 1","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java","lineNumber":447,"sourceCode":"        .setNameFormat(\"LocalJobRunner Map Task Executor #%d\")\n        .build();\n      ExecutorService executor = HadoopExecutors.newFixedThreadPool(\n          maxMapThreads, tf);\n\n      return executor;\n    }\n    \n    /**\n     * Creates the executor service used to run reduce tasks.\n     *\n     * @return an ExecutorService instance that handles reduce tasks\n     */\n    protected synchronized ExecutorService createReduceExecutor() {\n\n      // Determine the size of the thread pool to use\n      int maxReduceThreads = job.getInt(LOCAL_MAX_REDUCES, 1);\n      if (maxReduceThreads < 1) {\n        throw new IllegalArgumentException(\n            \"Configured \" + LOCAL_MAX_REDUCES + \" must be >= 1\");\n      }\n      maxReduceThreads = Math.min(maxReduceThreads, this.numReduceTasks);\n      maxReduceThreads = Math.max(maxReduceThreads, 1); // In case of no tasks.\n\n      LOG.debug(\"Starting reduce thread pool executor.\");\n      LOG.debug(\"Max local threads: \" + maxReduceThreads);\n      LOG.debug(\"Reduce tasks to process: \" + this.numReduceTasks);\n\n      // Create a new executor service to drain the work queue.\n      ExecutorService executor = HadoopExecutors.newFixedThreadPool(\n          maxReduceThreads);\n\n      return executor;\n    }\n\n    /** Run a set of tasks and waits for them to complete. */\n    private void runTasks(List<RunnableWithThrowable> runnables,","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-common/src/main/java/org/apache/hadoop/mapred/LocalJobRunner.java#L429-L465","documentation":"LocalJobRunner.createReduceExecutor sizes its reduce thread pool from mapreduce.local.reduce.tasks.maximum (LOCAL_MAX_REDUCES, default 1). A configured value below 1 - zero or negative - fails fast with IllegalArgumentException before the local job starts.","triggerScenarios":"Configuration sets mapreduce.local.reduce.tasks.maximum to 0 or a negative number - via an XML file, -D on the command line, or LocalJobRunner's setMaxReduceThreads API (LocalJobRunner.java:987).","commonSituations":"Same shape as the map-side error: copied tuning values, placeholder zeros in environment configs, attempts to serialize local reduces, property-name mix-ups with mapreduce.job.reduces.","solutions":["Set the property to 1 or higher, or remove it to fall back to the default 1","Guard programmatic setMaxReduceThreads calls with Math.max(1, n)","Inspect the failing job's job.xml to find which source set the bad value"],"exampleFix":"// before\nconf.setInt(\"mapreduce.local.reduce.tasks.maximum\", 0);\n\n// after\nconf.setInt(\"mapreduce.local.reduce.tasks.maximum\", 2);","handlingStrategy":"validation","validationCode":"int maxReduces = conf.getInt(\"mapreduce.local.reduce.tasks.maximum\", 1);\nif (maxReduces < 1) {\n  throw new IllegalArgumentException(\n      \"mapreduce.local.reduce.tasks.maximum must be >= 1, got \" + maxReduces);\n}\n// safe to run the local job","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate both mapreduce.local.*.tasks.maximum values in a shared config-check before any local run","Do not copy mapreduce.job.reduces tuning into the local-runner keys","Clamp programmatic setMaxReduceThreads calls with Math.max(1, n)"],"tags":["mapreduce","local-job-runner","configuration","thread-pool"],"backgroundTag":"invalid-configuration-value","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}