badges/shields · error · NotFound
target url not found
Error message
target url not found
What it means
The W3C validation service's transform throws NotFound 'target url not found' when the validator reports it could not resolve the target URL — typically a DNS failure ('Name or service not known') whose domain appears in the validated url. The service distinguishes 'validator can't fetch the page' from actual validation errors.
Source
Thrown at services/w3c/w3c-validation.service.js:134
}
transform(url, messages) {
if (messages.length === 1) {
const { subType, type, message } = messages[0]
if (type === 'non-document-error' && subType === 'io') {
let notFound = false
if (
message ===
'HTTP resource not retrievable. The HTTP status from the remote server was: 404.'
) {
notFound = true
} else if (message.endsWith('Name or service not known')) {
const domain = message.split(':')[0].trim()
notFound = url.indexOf(domain) !== -1
}
if (notFound) {
throw new NotFound({ prettyMessage: 'target url not found' })
}
}
}
return messages.reduce((accumulator, message) => {
let { type } = message
if (type === 'info') {
type = 'warning'
} else {
// All messages are suppose to have a type and there can only be info, error or non-document
// If a new type gets introduce this will flag them as errors
type = 'error'
}
if (!(type in accumulator)) {
accumulator[type] = 0
}
accumulator[type] += 1View on GitHub (pinned to 766fd8bc89)
Solutions
- Open the target URL in a browser to confirm it resolves publicly
- Fix typos in the domain in the badge URL
- Use the W3C validator reachable from your network for internal URLs, or expose the page publicly
- Wait for DNS propagation if the domain was recently changed
Example fix
// before https://img.shields.io/w3c-validity/http%3A%2F%2Flocallhost%3A3000 // after https://img.shields.io/w3c-validity/https%3A%2F%2Fexample.com
Defensive patterns
Strategy: validation
Validate before calling
// ensure the target URL is publicly resolvable before validating
const { hostname } = new URL(targetUrl)
await dns.promises.resolve(hostname) // throws if the domain does not resolve publicly Try / catch
try {
const badge = await w3cValidation.handle({ targetUrl })
} catch (e) {
if (e.message === 'target url not found') {
// show 'validation | unreachable' instead of failing
} else throw e
} Prevention
- Only validate URLs reachable from the public internet — never localhost or intranet hosts
- Double-check domain spelling before generating the badge
- After DNS changes, confirm the domain resolves publicly before validating
When it happens
Trigger: Validating a URL whose hostname does not resolve (typo, expired domain), or a hostname only resolvable inside a private network that the public W3C validator cannot reach.
Common situations: Validating localhost or internal staging URLs, typos in the domain, recently registered/expired domains, DNS propagation issues after a domain move.
Related errors
- invalid url
- invalid user id format
- makeBadge takes an argument of type object
- Field `message` is required
- Field `${field}` must be of type string
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/8cfbec16c49c4454.
Report an issue: GitHub.