{"record":{"id":"3505d6106e09de57","repo":"badges/shields","slug":"not-enabled-for-this-project","errorCode":null,"errorMessage":"not enabled for this project","messagePattern":"not enabled for this project","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/codacy/codacy-coverage.service.js","lineNumber":74,"sourceCode":"\n  async handle({ projectId, branch }) {\n    const { message: coverageString } = await this._requestSvg({\n      schema,\n      url: `https://api.codacy.com/project/badge/coverage/${encodeURIComponent(\n        projectId,\n      )}`,\n      options: { searchParams: { branch } },\n      valueMatcher: /text-anchor=\"middle\">([^<>]+)<\\/text>/,\n      httpErrors: {\n        404: 'project not found',\n      },\n    })\n\n    // When sending an invalid branch, Codacy ignores the branch, failing\n    // silently, so we can't provide an error message for this case.\n\n    if (coverageString === '!') {\n      throw new NotFound({\n        prettyMessage: 'not enabled for this project',\n      })\n    }\n\n    const { percentage } = this.constructor.transform({ coverageString })\n    return this.constructor.render({ percentage })\n  }\n}\n","sourceCodeStart":56,"sourceCodeEnd":83,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/codacy/codacy-coverage.service.js#L56-L83","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nGET /codacy/coverage/myrepo?branch=nonexistent-branch\n// after\nGET /codacy/coverage/myrepo?branch=main","handlingStrategy":"validation","validationCode":"// ensure the branch exists in the repo; Codacy silently ignores unknown branches\nconst branches = await repo.listBranches();\nif (branch && !branches.includes(branch)) throw new Error(`branch ${branch} does not exist`);","typeGuard":null,"tryCatchPattern":"try {\n  const badge = await fetchBadge(`/codacy/coverage/${repo}${branch ? `?branch=${branch}` : ''}`);\n} catch (e) {\n  if (e.status === 404 && e.message.includes('not enabled')) console.warn('coverage not reported for this project — run your coverage reporter');\n  else throw e;\n}","preventionTips":["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"],"tags":["not-found","codacy","coverage"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}