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

  1. Set up and run a coverage reporter (e.g. codacy-coverage-reporter) so coverage data reaches Codacy
  2. Remove or correct the branch parameter — invalid branch names are silently ignored and yield '!'
  3. Confirm in the Codacy UI that the project shows coverage data
  4. 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

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.