badges/shields · info · NotFound
not set up
Error message
not set up
What it means
The GitLab pipeline coverage service throws this NotFound error when the parsed pipeline coverage value equals the literal string 'unknown'. The upstream GitLab API returns no numeric coverage for the project/pipeline, so the service cannot render a percentage badge. This library converts the sentinel value into a 404-style 'not set up' badge instead of showing invalid data.
Source
Thrown at services/gitlab/gitlab-pipeline-coverage.service.js:103
async fetch({ project, baseUrl = 'https://gitlab.com', jobName, branch }) {
// Since the URL doesn't return a usable value when an invalid job name is specified,
// it is recommended to not use the query param at all if not required
jobName = jobName ? `?job=${jobName}` : ''
const url = `${baseUrl}/${decodeURIComponent(
project,
)}/badges/${branch}/coverage.svg${jobName}`
const httpErrors = httpErrorsFor('project not found')
return this._requestSvg({
schema,
url,
httpErrors,
})
}
static transform({ coverage }) {
if (coverage === 'unknown') {
throw new NotFound({ prettyMessage: 'not set up' })
}
return Number(coverage.slice(0, -1))
}
async handle(
{ project },
{ gitlab_url: baseUrl, job_name: jobName, branch },
) {
const { message: coverage } = await this.fetch({
project,
branch,
baseUrl,
jobName,
})
return this.constructor.render({
coverage: this.constructor.transform({ coverage }),
})
}View on GitHub (pinned to 766fd8bc89)
Solutions
- Add a coverage report to the GitLab CI test job (set the coverage regex in .gitlab-ci.yml or use coverage: '/.../' on the job) and rerun the pipeline so GitLab records coverage
- Verify the badge URL points at a project/branch that actually has a successful pipeline with coverage
- Check the GitLab project Settings > CI/CD > Test coverage parsing is configured
- If the project genuinely has no coverage, accept the badge's 'not set up' state or remove the badge
Example fix
// .gitlab-ci.yml before test: script: npm test // after test: script: npm test coverage: '/All files[^|]*\|[^|]*\s+([\d.]+)/'
Defensive patterns
Strategy: validation
Validate before calling
const res = await fetch(`https://gitlab.com/api/v4/projects/${encodeURIComponent(project)}/repository/branches/${branch}`)
const { coverage } = await (await fetch(`https://gitlab.com/api/v4/projects/${encodeURIComponent(project)}/pipelines?ref=${branch}`)).json()[0]?.coverage !== undefined ? {} : {}
if (!coverage) console.warn('No coverage configured for this project/branch') Type guard
const hasCoverage = (c) => typeof c === 'string' && c !== 'unknown' && c.endsWith('%') Try / catch
try {
const percent = GitlabPipelineCoverage.transform({ coverage })
} catch (e) {
if (e.prettyMessage === 'not set up') {
// show 'coverage not configured' placeholder
} else throw e
} Prevention
- Configure the coverage regex on your CI test job before adding the badge
- Verify the branch has at least one pipeline with coverage before publishing the badge
- Check GitLab's API coverage field via curl before embedding the badge
When it happens
Trigger: Calling the GitLab pipeline coverage badge for a project whose default branch has no pipeline with coverage data, or where test coverage reporting is disabled in .gitlab-ci.yml (no coverage regex configured) so GitLab never records a coverage percentage.
Common situations: Projects with no CI pipelines yet; pipelines that exist but whose test job lacks the coverage keyword; the project has pipelines on other branches but none on the requested one; coverage was recently added and the pipeline has not rerun.
Related errors
- branch not found
- no jobs found
- job not found
- build pipeline not found
- ${recordType.toLowerCase()} not found
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/a597b525554659a0.
Report an issue: GitHub.