{"record":{"id":"f5639200a2f605b3","repo":"apache/hadoop","slug":"incompatible-event-log-version-version","errorCode":null,"errorMessage":"Incompatible event log version: ${version}","messagePattern":"Incompatible event log version: (.+?)","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/mapreduce/jobhistory/EventReader.java","lineNumber":82,"sourceCode":"   */\n  @SuppressWarnings(\"deprecation\")\n  public EventReader(DataInputStream in) throws IOException {\n    this.in = in;\n    this.version = in.readLine();\n\n    Schema myschema = new SpecificData(Event.class.getClassLoader()).getSchema(Event.class);\n    Schema.Parser parser = new Schema.Parser();\n    String eventschema = in.readLine();\n    if (null != eventschema) {\n      try {\n        this.schema = parser.parse(eventschema);\n        this.reader = new SpecificDatumReader(schema, myschema);\n        if (EventWriter.VERSION.equals(version)) {\n          this.decoder = DecoderFactory.get().jsonDecoder(schema, in);\n        } else if (EventWriter.VERSION_BINARY.equals(version)) {\n          this.decoder = DecoderFactory.get().binaryDecoder(in, null);\n        } else {\n          throw new IOException(\"Incompatible event log version: \" + version);\n        }\n      } catch (AvroRuntimeException e) {\n        throw new IOException(e);\n      }\n    } else {\n      throw new IOException(\"Event schema string not parsed since its null\");\n    }\n  }\n  \n  /**\n   * Get the next event from the stream\n   * @return the next event\n   * @throws IOException\n   */\n  @SuppressWarnings(\"unchecked\")\n  public HistoryEvent getNextEvent() throws IOException {\n    Event wrapper;\n    try {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/jobhistory/EventReader.java#L64-L100","documentation":"MapReduce job history files (.jhist) begin with a version line written by EventWriter: \"Avro-Json\" or \"Avro-Binary\". EventReader accepts exactly those two tags and throws IOException(\"Incompatible event log version: v\") for any other first line, meaning the stream is not a job history in a known format.","triggerScenarios":"Constructing new EventReader(inputStream) on a file whose first line is neither \"Avro-Json\" nor \"Avro-Binary\" - a non-history file (job.xml, logs, configs) passed to history parsing, a history written by an incompatible/renamed format, or a file whose first line was corrupted.","commonSituations":"Running 'mapreduce job -history' or HistoryViewer/JobHistoryParser against the wrong file (e.g. from the wrong directory or a job conf instead of .jhist); tooling that globs a directory and feeds every file to EventReader; cross-version history migration.","solutions":["Point history tooling at real .jhist files (done/ or intermediatedone/ history directories: job_*.jhist).","Verify the header before parsing: read the first line and check it is Avro-Json or Avro-Binary.","If the file was written by a different Hadoop line, read it with a Hadoop build matching the writer.","Discard files with unrecognized headers when scanning directories instead of failing the scan."],"exampleFix":"# before: wrong file fed to history tooling\nhadoop job -history /user/me/Logs/application_1690000000000_0001/job_1690000000000_0001-1690000000000-user-word+count-1-0-conf.xml\n\n# after: real history file (check header first)\nhdfs dfs -cat <path>/job_...jhist | head -1   # must print Avro-Json (or Avro-Binary)\nhadoop job -history <path>/job_...jhist","handlingStrategy":"try-catch","validationCode":"// peek the header before building an EventReader\ntry (FSDataInputStream in = fs.open(path)) {\n  String version = in.readLine();\n  if (!(\"Avro-Json\".equals(version) || \"Avro-Binary\".equals(version))) {\n    // not a readable jhist - skip it\n  }\n}","typeGuard":null,"tryCatchPattern":"catch (IOException e) around new EventReader(in): on \"Incompatible event log version\" close the stream, skip the file in directory scans, and report the file plus its first line for diagnosis.","preventionTips":["Consume only job_*.jhist files from the done history directories.","Validate the first line is Avro-Json/Avro-Binary before parsing.","Keep reader and writer Hadoop versions aligned when migrating history across clusters."],"tags":["hadoop","mapreduce","jobhistory","version-mismatch","ioexception"],"backgroundTag":"file-format-version-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}