{"record":{"id":"a87ef47f71ed3fff","repo":"apache/hadoop","slug":"ouput-format-not-set-for-lazyoutputformat","errorCode":null,"errorMessage":"Ouput format not set for LazyOutputFormat","messagePattern":"Ouput format not set for LazyOutputFormat","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/LazyOutputFormat.java","lineNumber":75,"sourceCode":"    return new LazyRecordWriter<K, V>(job, baseOut, name, progress);\n  }\n\n  @Override\n  public void checkOutputSpecs(FileSystem ignored, JobConf job) \n  throws IOException {\n    if (baseOut == null) {\n      getBaseOutputFormat(job);\n    }\n    super.checkOutputSpecs(ignored, job);\n  }\n\n  @SuppressWarnings(\"unchecked\")\n  private void getBaseOutputFormat(JobConf job) throws IOException {\n    baseOut = ReflectionUtils.newInstance(\n        job.getClass(\"mapreduce.output.lazyoutputformat.outputformat\", null, OutputFormat.class), \n        job); \n    if (baseOut == null) {\n      throw new IOException(\"Ouput format not set for LazyOutputFormat\");\n    }\n  }\n  \n  /**\n   * <code>LazyRecordWriter</code> is a convenience \n   * class that works with LazyOutputFormat.\n   */\n\n  private static class LazyRecordWriter<K,V> extends FilterRecordWriter<K,V> {\n\n    final OutputFormat of;\n    final String name;\n    final Progressable progress;\n    final JobConf job;\n\n    public LazyRecordWriter(JobConf job, OutputFormat of, String name,\n        Progressable progress)  throws IOException {\n      this.of = of;","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/LazyOutputFormat.java#L57-L93","documentation":"LazyOutputFormat suppresses the creation of empty part files by wrapping a real OutputFormat that it reads from the job configuration key 'mapreduce.output.lazyoutputformat.outputformat'. getBaseOutputFormat() resolves that key and throws this IOException (note the original typo 'Ouput') when the configured class is null — i.e. the key was never set. It typically fires at checkOutputSpecs() time, which runs during job submission.","triggerScenarios":"Calling job.setOutputFormatClass(LazyOutputFormat.class) manually instead of LazyOutputFormat.setOutputFormatClass(job, RealFormat.class). The static helper is the only code that sets 'mapreduce.output.lazyoutputformat.outputformat'; setting the format class directly leaves the key empty, so job.getClass(..., null, ...) returns null and the IOException is thrown.","commonSituations":"Migrating old jobs to use lazy output (often combined with MultipleOutputs to avoid empty part files); copying example code that sets the output format class directly; the key being lost when a JobConf is reconstructed from XML that never contained it.","solutions":["Use LazyOutputFormat.setOutputFormatClass(job, TextOutputFormat.class) — it sets both the lazy wrapper and the underlying format key","If configuring by hand, set the key explicitly: job.setClass(\"mapreduce.output.lazyoutputformat.outputformat\", TextOutputFormat.class, OutputFormat.class)","Verify in the submitted job.xml that mapreduce.output.lazyoutputformat.outputformat is present before launching"],"exampleFix":"// before: sets only the wrapper, underlying key missing -> IOException\njob.setOutputFormatClass(LazyOutputFormat.class);\n\n// after: sets LazyOutputFormat AND mapreduce.output.lazyoutputformat.outputformat\nLazyOutputFormat.setOutputFormatClass(job, TextOutputFormat.class);","handlingStrategy":"validation","validationCode":"// assert the lazy-output config before submitting\nClass<?> base = conf.getClass(\"mapreduce.output.lazyoutputformat.outputformat\", null, OutputFormat.class);\nif (LazyOutputFormat.class.equals(conf.getOutputFormatClass()) && base == null) {\n  throw new IllegalStateException(\"call LazyOutputFormat.setOutputFormatClass(conf, RealFormat.class)\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure lazy output through LazyOutputFormat.setOutputFormatClass(job, RealFormat.class) — never job.setOutputFormatClass(LazyOutputFormat.class)","After building the JobConf, grep it (conf.get on the key) as a cheap smoke test","Watch for this after refactors: renaming the real OutputFormat class usually leaves the key pointing at the old name"],"tags":["hadoop","mapreduce","lazyoutputformat","outputformat","configuration"],"backgroundTag":"missing-configuration-property","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}