{"record":{"id":"c15eeb93f3b72b3d","repo":"badges/shields","slug":"no-coverage-data-available","errorCode":null,"errorMessage":"no coverage data available","messagePattern":"no coverage data available","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/teamcity/teamcity-coverage.service.js","lineNumber":73,"sourceCode":"  }\n\n  transform({ data }) {\n    let covered, total\n\n    for (const p of data.property) {\n      if (p.name === 'CodeCoverageAbsSCovered') {\n        covered = +p.value\n      } else if (p.name === 'CodeCoverageAbsSTotal') {\n        total = +p.value\n      }\n\n      if (covered !== undefined && total !== undefined) {\n        const coverage = covered ? (covered / total) * 100 : 0\n        return { coverage }\n      }\n    }\n\n    throw new InvalidResponse({ prettyMessage: 'no coverage data available' })\n  }\n\n  async handle({ buildId }, { server = 'https://teamcity.jetbrains.com' }) {\n    // JetBrains Docs: https://confluence.jetbrains.com/display/TCD18/REST+API#RESTAPI-Statistics\n    const buildLocator = `buildType:(id:${buildId})`\n    const apiPath = `app/rest/builds/${encodeURIComponent(\n      buildLocator,\n    )}/statistics`\n    const data = await this.fetch({\n      url: `${server}/${apiPath}`,\n      schema: buildStatisticsSchema,\n    })\n\n    const { coverage } = this.transform({ data })\n    return this.constructor.render({ coverage })\n  }\n}\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/teamcity/teamcity-coverage.service.js#L55-L91","documentation":"TeamCity coverage badge's `transform` extracts covered/total statistics from the TeamCity REST build statistics endpoint. When the statisticValue entries for the coverage counters are absent (undefined), it throws an InvalidResponse — not NotFound — with 'no coverage data available', meaning the build reported no coverage data at all.","triggerScenarios":"Calling /teamcity-coverage/<buildId> (against `server`, default https://teamcity.jetbrains.com) where the finished build's /app/rest/builds/<locator>/statistics contains no coverage-related statistic values — e.g. builds whose tests run without coverage instrumentation.","commonSituations":"Build configuration without Java code coverage enabled (no IDEA coverage/jacoco agent); buildId points at a personal/failed/canceled build that produced no statistics; wrong TeamCity server URL so statistics come back empty for the locator; coverage counters renamed/missing in newer TeamCity.","solutions":["Enable code coverage in the TeamCity build configuration (e.g. IDEA coverage or JaCoCo agent) and re-run the build","Verify the buildId belongs to a successful, finished build that ran with coverage","Confirm the `server` param points to the right TeamCity instance and the build exists there","Inspect GET <server>/app/rest/builds/buildType:(id:<buildId>)/statistics to confirm coverage statistic keys exist"],"exampleFix":"// before\n/badge/teamcity-coverage/MyBuildId?server=https://teamcity.example.com  // build has no coverage agent\n// after: enable IDEA/JaCoCo coverage in the build config, re-run, then keep the same badge URL","handlingStrategy":"try-catch","validationCode":"const stats = await fetch(`${server}/app/rest/builds/buildType:(id:${buildId})/statistics`, { headers }).then(r => r.json());\nconst hasCoverage = (stats?.property || []).some(p => /coverage/i.test(p.name));\nif (!hasCoverage) throw new Error('build ran without coverage instrumentation');","typeGuard":"const hasCoverageStats = (json) => Array.isArray(json?.property) && json.property.some(p => /coverage/i.test(String(p.name)));","tryCatchPattern":"try {\n  return await teamcityCoverage({ buildId, server });\n} catch (err) {\n  if (err message includes 'no coverage data available') {\n    // render 'coverage unknown' badge; enable coverage in the build config\n  } else throw err;\n}","preventionTips":["Enable code coverage (IDEA coverage or JaCoCo) in the TeamCity build configuration","Point buildId at finished, successful builds only","Verify the `server` URL matches the TeamCity instance hosting the build","Check /app/rest/builds/<locator>/statistics shows coverage counters before embedding the badge"],"tags":["teamcity","coverage","missing-data","invalid-response"],"backgroundTag":"missing-coverage-data","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}