{"record":{"id":"cea9250fd9b868d8","repo":"NationalSecurityAgency/ghidra","slug":"unknown-tag-el-getname-cea925","errorCode":null,"errorMessage":"Unknown tag: {el.getName()}","messagePattern":"Unknown tag: (.+?)","errorType":"exception","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/protocol/QueryNearestVector.java","lineNumber":95,"sourceCode":"\t\t\tfwrite.append(\"<vectormax>\").append(SpecXmlUtils.encodeSignedInteger(vectormax)).append(\"</vectormax>\\n\");\n\t\tfwrite.append(\"</\").append(name).append(\">\\n\");\n\t}\n\n\t@Override\n\tpublic void restoreXml(XmlPullParser parser, LSHVectorFactory vectorFactory) throws LSHException {\n\t\tvectormax = 0;\t\t\t// Default\n\t\tparser.start(name);\n\t\tmanage.restoreXml(parser, vectorFactory);\n\t\tparser.start(\"simthresh\");\n\t\tthresh = Double.parseDouble(parser.end().getText());\n\t\tparser.start(\"signifthresh\");\n\t\tsignifthresh = Double.parseDouble(parser.end().getText());\n\t\twhile (parser.peek().isStart()) {\n\t\t\tXmlElement el = parser.start();\n\t\t\tif (el.getName().equals(\"vectormax\"))\n\t\t\t\tvectormax = SpecXmlUtils.decodeInt(parser.end().getText());\n\t\t\telse\n\t\t\t\tthrow new LSHException(\"Unknown tag: \"+el.getName());\n\n\t\t}\n\t\tparser.end();\n\t}\n\n}\n","sourceCodeStart":77,"sourceCodeEnd":102,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/protocol/QueryNearestVector.java#L77-L102","documentation":"Thrown by QueryNearestVector.restoreXml while deserializing a <querynearestvector> BSim request. After manage/simthresh/signifthresh, the only optional child element accepted is <vectormax>; any other start element raises LSHException. Like QueryNearest, this is strict schema enforcement during XML parsing.","triggerScenarios":"Calling QueryNearestVector.restoreXml(parser, vectorFactory) where the XML body contains an element other than <vectormax>. Typically a version mismatch (a newer client serializes a tag like <categories> or <exefilter> that QueryNearestVector does not support) or corrupt/hand-edited XML.","commonSituations":"BSim client/server version skew. Confusing QueryNearest XML (which supports more tags) with QueryNearestVector XML. Manually authored request XML with extra elements.","solutions":["Use matching Ghidra/BSim versions on client and server.","If you have a QueryNearest-style payload, send it as <querynearest>, not <querynearestvector>.","Pre-validate that child elements of the body are only <vectormax> before calling restoreXml.","Regenerate the XML from a QueryNearestVector object via saveXml rather than hand-authoring."],"exampleFix":"// before\nQueryNearestVector q = new QueryNearestVector();\nq.restoreXml(parser, vectorFactory); // unknown tag\n\n// after - regenerate from object instead of feeding alien XML\nQueryNearestVector q = new QueryNearestVector();\nq.thresh = 0.7;\nq.signifthresh = 0.0;\nq.vectormax = 50;\nStringWriter sw = new StringWriter();\nq.saveXml(sw);\n// parse sw.toString() back - guaranteed schema-valid","handlingStrategy":"validation","validationCode":"// QueryNearestVector accepts only <vectormax> after the fixed children\nSet<String> allowed = Set.of(\"vectormax\");\n// pre-walk body starts and verify each name is in `allowed` before restoreXml","typeGuard":"static boolean isKnownQueryNearestVectorChild(String tag) {\n    return \"vectormax\".equals(tag);\n}","tryCatchPattern":"try {\n    q.restoreXml(parser, vectorFactory);\n} catch (LSHException e) {\n    if (e.getMessage().startsWith(\"Unknown tag:\")) {\n        // likely a QueryNearest payload fed to a vector query parser\n        throw new LSHException(\"Wrong query type or version: \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Do not feed QueryNearest XML into QueryNearestVector.restoreXml.","Match client/server Ghidra versions.","Regenerate XML via QueryNearestVector.saveXml instead of editing by hand."],"tags":["bsim","xml","deserialization","schema-version"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}