jenkinsci/jenkins · error · IOException
Failed to parse XML
Error message
Failed to parse XML
What it means
IOException wrapping a SAXException thrown while parsing a config.xml file to extract requested plugin dependencies. The XML is parsed with a secure SAXParser (disallowing DOCTYPE declarations and enabling secure processing). Any malformed XML, unexpected encoding, or XML structure violation triggers this.
Source
Thrown at core/src/main/java/hudson/PluginManager.java:2329
throw new SAXException("Malformed plugin attribute: " + plugin);
}
int at = plugin.indexOf('@');
String shortName = plugin.substring(0, at);
VersionNumber existing = requestedPlugins.get(shortName);
VersionNumber requested = new VersionNumber(plugin.substring(at + 1));
if (existing == null || existing.compareTo(requested) < 0) {
requestedPlugins.put(shortName, requested);
}
}
@Override public InputSource resolveEntity(String publicId, String systemId) throws IOException,
SAXException {
return RestrictiveEntityResolver.INSTANCE.resolveEntity(publicId, systemId);
}
});
} catch (SAXException x) {
throw new IOException("Failed to parse XML", x);
} catch (ParserConfigurationException e) {
throw new AssertionError(e); // impossible since we don't tweak XMLParser
}
return requestedPlugins;
}
@Restricted(DoNotUse.class) // table.jelly
public MetadataCache createCache() {
return new MetadataCache();
}
/**
* Disable a list of plugins using a strategy for their dependents plugins.
* @param strategy the strategy regarding how the dependent plugins are processed
* @param plugins the list of plugins
* @return the list of results for every plugin and their dependent plugins.
* @throws IOException see {@link PluginWrapper#disable()}
*/View on GitHub (pinned to 2e228ff40b)
Solutions
- Validate the config.xml file with an XML validator (xmllint, an IDE) before loading.
- Restore config.xml from backup if corrupted.
- Check file encoding — must be valid UTF-8.
- Inspect the wrapped SAXException (e.getCause()) for line/column of the parse error.
Example fix
# before — config.xml has a syntax error (unclosed tag) # <project> ... (missing </project>) # fix xmllint --noout config.xml # validate # correct the XML structure, then reload
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate XML well-formedness before passing to parseRequestedPlugins
try {
DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(configXml);
} catch (Exception e) {
throw new IllegalArgumentException("config.xml is not well-formed XML: " + e.getMessage(), e);
} Try / catch
try {
Map<String, VersionNumber> deps = pluginManager.parseRequestedPlugins(configXml);
} catch (IOException e) {
Throwable cause = e.getCause();
listener.error("Failed to parse config.xml: " + (cause != null ? cause.getMessage() : e.getMessage()));
// recover from backup or skip plugin dependency resolution
} Prevention
- Validate config.xml with xmllint or an XML parser before loading.
- Keep backups of config.xml to restore from corruption.
- Ensure config.xml is saved atomically (write to temp, rename) to avoid truncation.
When it happens
Trigger: config.xml content that is not well-formed XML, contains invalid characters, has encoding issues, or triggers a SAX parse error during the dependency extraction pass.
Common situations: Corrupted or truncated config.xml file (e.g., from a disk-full write, interrupted save), manually edited XML with syntax errors, or a config.xml from an incompatible Jenkins version with unexpected structure.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Malformed plugin attribute: {0}
- Failed to detect encoding of {}
- {0} plugin is already installed. Jenkins needs to be restart
- This Jenkins lifecycle does not support dynamic loading of p
- {0} plugin doesn’t support dynamic loading. Jenkins needs to
AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14).
Data as JSON: /api/errors/c9693357fe49f829.
Report an issue: GitHub.