{"record":{"id":"bd30ae93ecc9ad13","repo":"zaproxy/zaproxy","slug":"add-on-name-contains-malformed-zapaddon-xml-fi","errorCode":null,"errorMessage":"Add-on \"{name}\" contains malformed zapAddOn.xml file, {reason}","messagePattern":"Add-on \"(.+?)\" contains malformed zapAddOn\\.xml file, (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"zap/src/main/java/org/zaproxy/zap/control/BaseZapAddOnXmlData.java","lineNumber":464,"sourceCode":"            extensionsWithDeps.add(new ExtensionWithDeps(classname, addOnDeps, classnames));\n        }\n\n        return extensionsWithDeps;\n    }\n\n    private AddOnClassnames readAddOnClassnames(HierarchicalConfiguration node) {\n        List<String> allowed =\n                getStrings(node, CLASSNAMES_ALLOWED_ALL_ELEMENTS, CLASSNAMES_ALLOWED_ELEMENT);\n        List<String> restricted =\n                getStrings(node, CLASSNAMES_RESTRICTED_ALL_ELEMENTS, CLASSNAMES_RESTRICTED_ELEMENT);\n        if (allowed.isEmpty() && restricted.isEmpty()) {\n            return AddOnClassnames.ALL_ALLOWED;\n        }\n        return new AddOnClassnames(allowed, restricted);\n    }\n\n    private void malformedFile(String reason) {\n        throw new IllegalArgumentException(\n                \"Add-on \\\"\"\n                        + name\n                        + \"\\\" contains malformed \"\n                        + AddOn.MANIFEST_FILE_NAME\n                        + \" file, \"\n                        + reason);\n    }\n\n    public static class Dependencies {\n\n        private final String javaVersion;\n\n        private final List<AddOnDep> addOnDependencies;\n\n        public Dependencies(String javaVersion, List<AddOnDep> addOnDependencies) {\n            this.javaVersion = javaVersion;\n            this.addOnDependencies = addOnDependencies;\n        }","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/zaproxy/zaproxy/blob/9d1970a436b1b189bfb588fc88864c80d9baf6a5/zap/src/main/java/org/zaproxy/zap/control/BaseZapAddOnXmlData.java#L446-L482","documentation":"Internal helper that throws IllegalArgumentException when a required element of zapAddOn.xml is missing or structurally invalid during dependency/extension parsing (readDependencies, readAddOnDependencies, readExtensionsWithDeps). The message names the add-on, the manifest file, and the specific reason.","triggerScenarios":"Parsing a manifest whose <dependencies> or <extensions> section is malformed: missing child elements, wrong element names, or invalid structure where the parser expects mandatory data.","commonSituations":"Hand-edited manifests with wrong XML structure; manifests from older add-on formats missing elements the current parser requires; copy-paste errors between manifests; truncation during editing.","solutions":["Read the 'reason' part of the message to find the exact missing/invalid element in zapAddOn.xml","Regenerate the manifest from the official add-on project template (zap-extensions template) and re-add fields","Validate zapAddOn.xml against the ZAP manifest schema before packaging","Diff your manifest against a working add-on's manifest to spot structural issues"],"exampleFix":"<!-- before -->\n<dependencies></dependencies>\n<!-- after -->\n<dependencies>\n  <dependency id=\"selenium\" />\n</dependencies>","handlingStrategy":"validation","validationCode":"Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder()\n    .parse(new InputSource(new StringReader(manifestXml)));\nif (doc.getElementsByTagName(\"dependencies\").getLength() > 0) {\n    NodeList deps = doc.getElementsByTagName(\"dependency\");\n    if (deps.getLength() == 0) throw new IllegalArgumentException(\"<dependencies> missing <dependency> children\");\n}","typeGuard":null,"tryCatchPattern":"try { parseManifest(xml); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"contains malformed zapAddOn.xml\")) { LOGGER.error(\"Fix manifest structure: {}\", e.getMessage()); } throw e; }","preventionTips":["Regenerate manifests from the official template rather than hand-editing","Validate the manifest XML structure against the ZAP schema before packaging","Keep dependency/extension elements present and correctly named even when empty"],"tags":["addon","manifest","xml-validation","parse-error"],"backgroundTag":"malformed-manifest-file","analyzedSha":"9d1970a436b1b189bfb588fc88864c80d9baf6a5","analyzedAt":"2026-09-05T19:26:59.356Z","contentChangedAt":"2026-09-05T19:26:59.356Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}