badges/shields · error · NotFound

repository not found

Error message

repository not found

What it means

docker-helpers.getMultiPageData throws NotFound with prettyMessage 'repository not found' when the Docker Hub API returns count === 0 for the tags listing of the requested user/repo. A zero count means Docker Hub has no tags at all for that repository, which the service treats as the repository effectively not being usable/found.

Source

Thrown at services/docker/docker-helpers.js:51

      pattern: ':user/:repo/:tag*',
    }
  } else {
    return {
      base: `docker/${badgeName}`,
      pattern: ':user/:repo',
    }
  }
}

function getDockerHubUser(user) {
  return user === '_' ? 'library' : user
}

async function getMultiPageData({ user, repo, fetch }) {
  const data = await fetch({ user, repo })

  if (data.count === 0) {
    throw new NotFound({ prettyMessage: 'repository not found' })
  }

  const numberOfPages = Math.ceil(data.count / 100) // Maximum of 100 results can be returned per page

  if (numberOfPages === 1) {
    return data.results
  }

  const pageData = await Promise.all(
    [...Array(numberOfPages - 1).keys()].map((_, i) =>
      fetch({ user, repo, page: ++i + 1 }),
    ),
  )
  return [...data.results].concat(...pageData.map(p => p.results))
}

function getDigestSemVerMatches({ data, digest }) {
  const matches = data

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Verify the repository exists on Docker Hub (https://hub.docker.com/r/<user>/<repo>) and has at least one tag
  2. Check the user/repo spelling in the badge URL
  3. If the repo is private, badges cannot access it anonymously - make it public or use an authenticated context
  4. Push at least one image tag to the repository

Example fix

// before
/badge/docker/pulls/myuser/no-such-repo -> repository not found
// after
/badge/docker/pulls/library/nginx
Defensive patterns

Strategy: validation

Validate before calling

async function dockerRepoHasTags(user, repo) {
  const res = await fetch(`https://hub.docker.com/v2/repositories/${user}/${repo}/tags?page_size=1`)
  if (!res.ok) return false
  const data = await res.json()
  return data.count > 0
}

Type guard

function hasTagResults(data) {
  return typeof data?.count === 'number' && data.count > 0 && Array.isArray(data.results)
}

Try / catch

try {
  const data = await getDockerBadge(user, repo)
} catch (err) {
  if (err.prettyMessage === 'repository not found') {
    data = null // show 'repo not found' fallback
  } else throw err
}

Prevention

When it happens

Trigger: Requesting a Docker badge for a user/repo whose tags list has count 0 - the namespace doesn't exist, the repo was deleted, or the repo exists but has zero tags.

Common situations: Typo in the Docker Hub namespace or repository name; private repos invisible to unauthenticated API calls; deleted or newly created repos with no pushes yet.

Related errors


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