{"record":{"id":"65cebb6f4c729dcc","repo":"apache/hadoop","slug":"expected-data-65cebb","errorCode":null,"errorMessage":"expected </DATA>","messagePattern":"expected </DATA>","errorType":"validation","errorClass":"InvalidXmlException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsXmlLoader.java","lineNumber":221,"sourceCode":"        state = ParseState.EXPECT_END;\n      } else if (!name.equals(\"RECORD\")) {\n        throw new InvalidXmlException(\"expected </EDITS> or </RECORD>\");\n      }\n      break;\n    case EXPECT_OPCODE:\n      if (!name.equals(\"OPCODE\")) {\n        throw new InvalidXmlException(\"expected </OPCODE>\");\n      }\n      opCode = FSEditLogOpCodes.valueOf(str);\n      state = ParseState.EXPECT_DATA;\n      break;\n    case EXPECT_DATA:\n      throw new InvalidXmlException(\"expected <DATA/>\");\n    case HANDLE_DATA:\n      stanza.setValue(str);\n      if (stanzaStack.empty()) {\n        if (!name.equals(\"DATA\")) {\n          throw new InvalidXmlException(\"expected </DATA>\");\n        }\n        state = ParseState.EXPECT_RECORD;\n        FSEditLogOp op = opCache.get(opCode);\n        opCode = null;\n        try {\n          op.decodeXml(stanza);\n          stanza = null;\n        } finally {\n          if (stanza != null) {\n            System.err.println(\"fromXml error decoding opcode \" + opCode +\n                \"\\n\" + stanza.toString());\n            stanza = null;\n          }\n        }\n        if (fixTxIds) {\n          if (nextTxId <= 0) {\n            nextTxId = op.getTransactionId();\n            if (nextTxId <= 0) {","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/offlineEditsViewer/OfflineEditsXmlLoader.java#L203-L239","documentation":"Thrown from endElement() in HANDLE_DATA state when the stanza stack is empty (we are at <DATA> depth) and the closing tag is not </DATA>. Inside <DATA>, each child element pushes a Stanza on open and pops on close; this error means a non-DATA close tag arrived at DATA depth — in practice mis-nested or unbalanced closing tags within the DATA block.","triggerScenarios":"Mis-nested closes inside DATA such as <DATA><NAME>foo</DATA></NAME>: the first </DATA> just pops NAME off the stanza stack, then </NAME> arrives with an empty stack and name != DATA, throwing. Duplicate or extra close tags inside DATA behave the same.","commonSituations":"Manual edits to record payloads; sed/regex surgery on DATA contents that breaks tag balance; files whose lines were rewrapped in the middle of a tag.","solutions":["Re-balance the tags inside the offending <DATA> block — every child element must be closed before </DATA>.","Locate the bad block by bisecting the file (split into halves of records and re-run oev) since the message carries no line number.","Restore the record from the original oev output and redo the edit with an XML-aware tool (xmllint --shell or an XML editor), not a text editor."],"exampleFix":"// before\n<DATA><NAME>foo</DATA></NAME></DATA>\n\n// after\n<DATA><NAME>foo</NAME></DATA>","handlingStrategy":"try-catch","validationCode":"# cheap pre-check: file must be well-formed XML\nxmllint --noout edits.xml && hdfs oev -i edits.xml -o out","typeGuard":null,"tryCatchPattern":"try {\n  loader.loadEdits();\n} catch (InvalidXmlException e) {\n  // mis-nested close tag inside a DATA stanza; bisect the file to find it\n  LOG.error(\"Unbalanced DATA stanza: {}\", e.getMessage());\n}","preventionTips":["Edit DATA payloads only with XML-aware tools, never regex/sed.","Run xmllint --noout before conversion to catch unbalanced tags.","When bisecting, split on RECORD boundaries and retry each half."],"tags":["hdfs","offline-edits-viewer","oev","edit-log","xml","nesting"],"backgroundTag":"malformed-xml-input","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}