{"record":{"id":"622c63f610100e48","repo":"badges/shields","slug":"digest-not-found-for-latest-tag","errorCode":null,"errorMessage":"digest not found for latest tag","messagePattern":"digest not found for latest tag","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/docker/docker-version.service.js","lineNumber":129,"sourceCode":"      schema: buildSchema,\n      url: `https://registry.hub.docker.com/v2/repositories/${getDockerHubUser(\n        user,\n      )}/${repo}/tags?page_size=100&ordering=last_updated${page}`,\n      httpErrors: { 404: 'repository or tag not found' },\n    })\n  }\n\n  transform({ tag, sort, data, pagedData, arch = 'amd64' }) {\n    let version\n\n    if (!tag && sort === 'date') {\n      version = data.results[0].name\n      if (version !== 'latest') {\n        return { version }\n      }\n      const imageTag = data.results[0].images.find(i => i.architecture === arch) // Digest is the unique field that we utilise to match images\n      if (!imageTag) {\n        throw new InvalidResponse({\n          prettyMessage: 'digest not found for latest tag',\n        })\n      }\n      const { digest } = imageTag\n      return { version: getDigestSemVerMatches({ data: pagedData, digest }) }\n    } else if (!tag && sort === 'semver') {\n      const matches = data\n        .filter(d => d.images.some(image => image.architecture === arch))\n        .map(d => d.name)\n      if (matches.length === 0) {\n        throw new InvalidResponse({\n          prettyMessage: `no images found for arch ${arch}`,\n        })\n      }\n      return { version: latest(matches) }\n    } else {\n      version = data.find(d => d.name === tag)\n      if (!version) {","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/docker/docker-version.service.js#L111-L147","documentation":"DockerVersion.transform throws InvalidResponse with prettyMessage 'digest not found for latest tag' when the most recent tag is literally 'latest' and no image in its images list matches the requested architecture, so the digest needed to resolve the underlying version cannot be located. This is an unexpected/invalid API response rather than a user-facing not-found condition.","triggerScenarios":"Requesting a Docker version badge where the newest tag is 'latest', the requested arch has no matching entry in data.results[0].images (missing imageTag), so the digest-based semver resolution cannot proceed.","commonSituations":"Single-arch images queried with another arch while latest is the newest tag; Docker Hub returning images lists without the expected architecture/digest fields; arch string mismatches.","solutions":["Ensure ?arch= matches an architecture actually published for the latest tag (amd64, arm64, ...)","Push a real semver tag (e.g. v1.2.3) instead of relying on 'latest' so the digest-lookup path is skipped","Inspect the Hub tags API response to confirm the images array contains the arch with a digest","If Hub changed the response shape, the service may need updating"],"exampleFix":"// before\n/badge/docker/v/myuser/myimage?arch=aarch64&sort=date  # latest tag lacks aarch64 -> digest not found for latest tag\n// after\n/badge/docker/v/myuser/myimage?arch=amd64&sort=date","handlingStrategy":"type-guard","validationCode":"async function latestTagHasDigestForArch(user, repo, arch) {\n  const res = await fetch(`https://hub.docker.com/v2/repositories/${user}/${repo}/tags?page_size=100`)\n  const data = await res.json()\n  const latest = (data.results ?? []).find(t => t.name === 'latest')\n  if (!latest) return true // digest path not used\n  return (latest.images ?? []).some(i => i.architecture === arch && i.digest)\n}","typeGuard":"function hasDigestForArch(tag, arch) {\n  const img = tag?.images?.find(i => i.architecture === arch)\n  return typeof img?.digest === 'string' && img.digest.length > 0\n}","tryCatchPattern":"try {\n  const version = await getDockerVersionBadge(user, repo, { arch, sort: 'date' })\n} catch (err) {\n  if (err.prettyMessage === 'digest not found for latest tag') {\n    version = null // fall back to 'unknown'\n  } else throw err\n}","preventionTips":["Ensure ?arch= matches an architecture present in the latest tag's images list","Publish real semver tags rather than only 'latest' to avoid the digest-resolution path","Check the Hub API response includes digest fields for your arch","For your own images, build multi-arch manifests with digests"],"tags":["docker","digest","architecture","invalid-response"],"backgroundTag":"docker-digest-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}