badges/shields · error · InvalidResponse

digest not found for latest tag

Error message

digest not found for latest tag

What it means

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.

Source

Thrown at services/docker/docker-version.service.js:129

      schema: buildSchema,
      url: `https://registry.hub.docker.com/v2/repositories/${getDockerHubUser(
        user,
      )}/${repo}/tags?page_size=100&ordering=last_updated${page}`,
      httpErrors: { 404: 'repository or tag not found' },
    })
  }

  transform({ tag, sort, data, pagedData, arch = 'amd64' }) {
    let version

    if (!tag && sort === 'date') {
      version = data.results[0].name
      if (version !== 'latest') {
        return { version }
      }
      const imageTag = data.results[0].images.find(i => i.architecture === arch) // Digest is the unique field that we utilise to match images
      if (!imageTag) {
        throw new InvalidResponse({
          prettyMessage: 'digest not found for latest tag',
        })
      }
      const { digest } = imageTag
      return { version: getDigestSemVerMatches({ data: pagedData, digest }) }
    } else if (!tag && sort === 'semver') {
      const matches = data
        .filter(d => d.images.some(image => image.architecture === arch))
        .map(d => d.name)
      if (matches.length === 0) {
        throw new InvalidResponse({
          prettyMessage: `no images found for arch ${arch}`,
        })
      }
      return { version: latest(matches) }
    } else {
      version = data.find(d => d.name === tag)
      if (!version) {

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Ensure ?arch= matches an architecture actually published for the latest tag (amd64, arm64, ...)
  2. Push a real semver tag (e.g. v1.2.3) instead of relying on 'latest' so the digest-lookup path is skipped
  3. Inspect the Hub tags API response to confirm the images array contains the arch with a digest
  4. If Hub changed the response shape, the service may need updating

Example fix

// before
/badge/docker/v/myuser/myimage?arch=aarch64&sort=date  # latest tag lacks aarch64 -> digest not found for latest tag
// after
/badge/docker/v/myuser/myimage?arch=amd64&sort=date
Defensive patterns

Strategy: type-guard

Validate before calling

async function latestTagHasDigestForArch(user, repo, arch) {
  const res = await fetch(`https://hub.docker.com/v2/repositories/${user}/${repo}/tags?page_size=100`)
  const data = await res.json()
  const latest = (data.results ?? []).find(t => t.name === 'latest')
  if (!latest) return true // digest path not used
  return (latest.images ?? []).some(i => i.architecture === arch && i.digest)
}

Type guard

function hasDigestForArch(tag, arch) {
  const img = tag?.images?.find(i => i.architecture === arch)
  return typeof img?.digest === 'string' && img.digest.length > 0
}

Try / catch

try {
  const version = await getDockerVersionBadge(user, repo, { arch, sort: 'date' })
} catch (err) {
  if (err.prettyMessage === 'digest not found for latest tag') {
    version = null // fall back to 'unknown'
  } else throw err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/622c63f610100e48. Report an issue: GitHub.