badges/shields · error · InvalidResponse
no result
Error message
no result
What it means
The dynamic XML badge service runs an XPath query against the fetched XML document. It throws InvalidResponse with prettyMessage 'no result' when the XPath expression evaluates successfully but returns an empty node set, meaning the badge cannot compute a value from the response.
Source
Thrown at services/dynamic/dynamic-xml.service.js:130
values = values.reduce((accum, node) => {
if (pathIsAttr) {
accum.push(node.value)
} else if (node.firstChild) {
accum.push(node.firstChild.data)
} else {
accum.push(node.data)
}
return accum
}, [])
} else {
throw new InvalidResponse({
prettyMessage: 'unsupported query',
})
}
if (!values.length) {
throw new InvalidResponse({ prettyMessage: 'no result' })
}
return { values }
}
async handle(_namedParams, { url, query: pathExpression, prefix, suffix }) {
const { buffer, res } = await this._request({
url,
options: {
headers: { Accept: 'application/xml, text/xml' },
timeout: { request: 3500 },
},
httpErrors,
logErrors: [],
})
let contentType = 'text/xml'
if (res.headers['content-type']) {View on GitHub (pinned to 766fd8bc89)
Solutions
- Verify the XPath query against the actual XML returned by the url (fetch it and test the expression in a tool like xmllint or an XPath evaluator)
- Fix element/attribute names and namespaces in the query
- Use a prefix/suffix only after confirming the query matches at least one node
- If the value is legitimately optional, choose a different upstream endpoint that always exposes the data
Example fix
// before (URL whose XML has no <version> node) /badge/dynamic/xml?url=https://example.com/info.xml&query=//version // after /badge/dynamic/xml?url=https://example.com/info.xml&query=//project/version
Defensive patterns
Strategy: validation
Validate before calling
async function hasXPathResult(url, query) {
const res = await fetch(url)
const xml = await res.text()
const doc = new DOMParser().parseFromString(xml, 'application/xml')
return doc.evaluate(`count(${query})`, doc, null, XPathResult.NUMBER_TYPE, null).numberValue > 0
}
// call await hasXPathResult(myUrl, myQuery) before rendering the badge Try / catch
try {
const badge = await getDynamicXmlBadge({ url, query })
} catch (e) {
if (e.prettyMessage === 'no result') {
renderPlaceholderBadge('no data at XPath')
} else throw e
} Prevention
- Test the XPath expression against a live copy of the XML before embedding it in a badge URL
- Account for XML namespaces in the query (use local-name() or declare prefixes)
- Re-test badges when the upstream API announces schema changes
- Prefer querying stable, always-present elements
When it happens
Trigger: Calling the dynamic XML badge endpoint (/badge/dynamic/xml) with a url whose XML document does not contain any node matching the given XPath query (e.g. wrong element name, wrong namespace, document structure differs from expected).
Common situations: The upstream API changed its XML schema; the XPath uses a namespace prefix without declaring it; typo in the XPath expression; the queried element only exists in some responses (e.g. optional fields or empty lists).
Related errors
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/5a90ad88aef4d442.
Report an issue: GitHub.