badges/shields · error · NotFound

${noBranchInfoMessage}

Error message

${noBranchInfoMessage}

What it means

Scrutinizer badge error thrown when the API response contains no entry for the requested branch under json.applications[branch]. If a specific branch was requested the message is 'branch not found'; otherwise the default branch has no analyzed application data and the message is 'unavailable for default branch'.

Solutions

  1. Verify the branch name exactly matches what Scrutinizer analyzed (check the project page on scrutinizer-ci.com)
  2. Trigger/await a Scrutinizer build for the repo so applications data exists
  3. URL-encode branch names containing slashes (e.g. feature%2Ffoo)
  4. Remove the branch parameter to fall back to the default branch once it has an analysis

Example fix

// before
https://img.shields.io/scrutinizer/coverage/g/user/repo/master
// after (branch actually analyzed is 'main')
https://img.shields.io/scrutinizer/coverage/g/user/repo/main
Defensive patterns

Strategy: validation

Validate before calling

// Only request a branch badge for branches Scrutinizer has analyzed
async function branchAnalyzed(vcs, slug, branch) {
  const res = await fetch(`https://scrutinizer-ci.com/api/repositories/${vcs}/${slug}`)
  const repo = await res.json()
  return Boolean(repo.applications && repo.applications[branch])
}
if (!(await branchAnalyzed('g', 'user/repo', 'main'))) throw new Error('branch not analyzed on Scrutinizer')

Type guard

function hasBranchData(json, branch) {
  return Boolean(json && json.applications && json.applications[branch])
}

Try / catch

try {
  const badge = await fetchBadgeUrl(scrutinizerBadgeUrl)
} catch (e) {
  if (e.message === 'branch not found' || e.message === 'unavailable for default branch') {
    console.warn('No Scrutinizer analysis for that branch; falling back to default badge')
  } else throw e
}

Prevention

When it happens

Trigger: Requesting a Scrutinizer branch badge with a `branch` parameter that Scrutinizer has never analyzed, or requesting the default-branch badge for a project with no successful Scrutinizer analysis yet (no applications data in the API payload).

Common situations: Branch was deleted or renamed after analysis; new repo added to Scrutinizer but the first build has not run/completed; branch names with slashes needing URL encoding; typo in branch name.

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/65ca9b8caf758e17. Report an issue: GitHub.

Appendix: source

Thrown at services/scrutinizer/scrutinizer-base.js:24

    return this._requestJson({
      schema,
      url: `https://scrutinizer-ci.com/api/repositories/${vcs}/${slug}`,
      httpErrors: {
        401: 'not authorized to access project',
        404: 'project not found',
      },
    })
  }

  transformBranchInfo({ json, wantedBranch }) {
    const branch = wantedBranch || json.default_branch
    const noBranchInfoMessage = wantedBranch
      ? 'branch not found'
      : 'unavailable for default branch'

    const branchInfo = json.applications[branch]
    if (!branchInfo) {
      throw new NotFound({ prettyMessage: noBranchInfoMessage })
    }

    return branchInfo
  }

  transformBranchInfoMetricValue({ json, branch, metric }) {
    const branchInfo = this.transformBranchInfo({ json, wantedBranch: branch })
    if (!branchInfo.index) {
      throw new InvalidResponse({ prettyMessage: 'metrics missing for branch' })
    }
    const {
      index: {
        _embedded: {
          project: { metric_values: metricValues },
        },
      },
    } = branchInfo

View on GitHub (pinned to 766fd8bc89)