{"record":{"id":"8cfbec16c49c4454","repo":"badges/shields","slug":"target-url-not-found","errorCode":null,"errorMessage":"target url not found","messagePattern":"target url not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/w3c/w3c-validation.service.js","lineNumber":134,"sourceCode":"  }\n\n  transform(url, messages) {\n    if (messages.length === 1) {\n      const { subType, type, message } = messages[0]\n      if (type === 'non-document-error' && subType === 'io') {\n        let notFound = false\n        if (\n          message ===\n          'HTTP resource not retrievable. The HTTP status from the remote server was: 404.'\n        ) {\n          notFound = true\n        } else if (message.endsWith('Name or service not known')) {\n          const domain = message.split(':')[0].trim()\n          notFound = url.indexOf(domain) !== -1\n        }\n\n        if (notFound) {\n          throw new NotFound({ prettyMessage: 'target url not found' })\n        }\n      }\n    }\n\n    return messages.reduce((accumulator, message) => {\n      let { type } = message\n      if (type === 'info') {\n        type = 'warning'\n      } else {\n        // All messages are suppose to have a type and there can only be info, error or non-document\n        // If a new type gets introduce this will flag them as errors\n        type = 'error'\n      }\n\n      if (!(type in accumulator)) {\n        accumulator[type] = 0\n      }\n      accumulator[type] += 1","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/w3c/w3c-validation.service.js#L116-L152","documentation":"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.","triggerScenarios":"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.","commonSituations":"Validating localhost or internal staging URLs, typos in the domain, recently registered/expired domains, DNS propagation issues after a domain move.","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"],"exampleFix":"// before\nhttps://img.shields.io/w3c-validity/http%3A%2F%2Flocallhost%3A3000\n// after\nhttps://img.shields.io/w3c-validity/https%3A%2F%2Fexample.com","handlingStrategy":"validation","validationCode":"// ensure the target URL is publicly resolvable before validating\nconst { hostname } = new URL(targetUrl)\nawait dns.promises.resolve(hostname) // throws if the domain does not resolve publicly","typeGuard":null,"tryCatchPattern":"try {\n  const badge = await w3cValidation.handle({ targetUrl })\n} catch (e) {\n  if (e.message === 'target url not found') {\n    // show 'validation | unreachable' instead of failing\n  } else throw e\n}","preventionTips":["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"],"tags":["dns","not-found","validation","url"],"backgroundTag":"dns-resolution-failed","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}