badges/shields · error · NotFound
not enabled for this project
Error message
not enabled for this project
What it means
The Codacy coverage service throws NotFound with 'not enabled for this project' when the Codacy API returns '!' as the coverage string, its sentinel for a project/repository that has no coverage data. It means coverage reporting has not been set up for that repo.
Source
Thrown at services/codacy/codacy-coverage.service.js:74
async handle({ projectId, branch }) {
const { message: coverageString } = await this._requestSvg({
schema,
url: `https://api.codacy.com/project/badge/coverage/${encodeURIComponent(
projectId,
)}`,
options: { searchParams: { branch } },
valueMatcher: /text-anchor="middle">([^<>]+)<\/text>/,
httpErrors: {
404: 'project not found',
},
})
// When sending an invalid branch, Codacy ignores the branch, failing
// silently, so we can't provide an error message for this case.
if (coverageString === '!') {
throw new NotFound({
prettyMessage: 'not enabled for this project',
})
}
const { percentage } = this.constructor.transform({ coverageString })
return this.constructor.render({ percentage })
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Set up and run a coverage reporter (e.g. codacy-coverage-reporter) so coverage data reaches Codacy
- Remove or correct the branch parameter — invalid branch names are silently ignored and yield '!'
- Confirm in the Codacy UI that the project shows coverage data
- Check that the repo is public or that credentials are configured if it is private
Example fix
// before GET /codacy/coverage/myrepo?branch=nonexistent-branch // after GET /codacy/coverage/myrepo?branch=main
Defensive patterns
Strategy: validation
Validate before calling
// ensure the branch exists in the repo; Codacy silently ignores unknown branches
const branches = await repo.listBranches();
if (branch && !branches.includes(branch)) throw new Error(`branch ${branch} does not exist`); Try / catch
try {
const badge = await fetchBadge(`/codacy/coverage/${repo}${branch ? `?branch=${branch}` : ''}`);
} catch (e) {
if (e.status === 404 && e.message.includes('not enabled')) console.warn('coverage not reported for this project — run your coverage reporter');
else throw e;
} Prevention
- Run a coverage reporter (codacy-coverage-reporter or CI integration) before adding the badge
- Only pass branch parameters that actually exist in the repository
- Check the Codacy project dashboard shows coverage for the target branch
- For private repos, ensure credentials/access are configured
When it happens
Trigger: Requesting a codacy-coverage badge for a repository where coverage has never been reported to Codacy, or with an invalid branch (Codacy silently ignores unknown branches and returns the '!' sentinel).
Common situations: Private repos without API access configured, projects where the coverage reporter was never run, typos in the branch query parameter, or coverage integration removed/disabled.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/3505d6106e09de57.
Report an issue: GitHub.