{"record":{"id":"a6047dabba44b5fd","repo":"apache/hadoop","slug":"missing-reduce-spec","errorCode":null,"errorMessage":"Missing reduce spec","messagePattern":"Missing reduce spec","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/LoadJob.java","lineNumber":457,"sourceCode":"  public static class LoadReducer\n  extends Reducer<GridmixKey,GridmixRecord,NullWritable,GridmixRecord> {\n\n    private final Random r = new Random();\n    private final GridmixRecord val = new GridmixRecord();\n\n    private double acc;\n    private double ratio;\n    private RecordFactory factory;\n\n    private ResourceUsageMatcherRunner matcher = null;\n    private StatusReporter reporter = null;\n    \n    @Override\n    protected void setup(Context context)\n    throws IOException, InterruptedException {\n      if (!context.nextKey() \n          || context.getCurrentKey().getType() != GridmixKey.REDUCE_SPEC) {\n        throw new IOException(\"Missing reduce spec\");\n      }\n      long outBytes = 0L;\n      long outRecords = 0L;\n      long inRecords = 0L;\n      ResourceUsageMetrics metrics = new ResourceUsageMetrics();\n      for (GridmixRecord ignored : context.getValues()) {\n        final GridmixKey spec = context.getCurrentKey();\n        inRecords += spec.getReduceInputRecords();\n        outBytes += spec.getReduceOutputBytes();\n        outRecords += spec.getReduceOutputRecords();\n        if (spec.getReduceResourceUsageMetrics() != null) {\n          metrics = spec.getReduceResourceUsageMetrics();\n        }\n      }\n      if (0 == outRecords && inRecords > 0) {\n        LOG.info(\"Spec output bytes w/o records. Using input record count\");\n        outRecords = inRecords;\n      }","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/LoadJob.java#L439-L475","documentation":"Error \"Missing reduce spec\" thrown in apache/hadoop.","triggerScenarios":"A reduce task description is missing from the job story while constructing the Gridmix LoadJob, so the reduce-side load cannot be built.","commonSituations":"See trigger scenarios.","solutions":["Ensure the trace job contains reduce task information; a LoadJob was built from a job story with no reduce spec."],"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"}