{"record":{"id":"65ca9b8caf758e17","repo":"badges/shields","slug":"nobranchinfomessage","errorCode":null,"errorMessage":"${noBranchInfoMessage}","messagePattern":"\\$\\{noBranchInfoMessage\\}","errorType":"exception","errorClass":"NotFound","httpStatus":null,"severity":"error","filePath":"services/scrutinizer/scrutinizer-base.js","lineNumber":24,"sourceCode":"    return this._requestJson({\n      schema,\n      url: `https://scrutinizer-ci.com/api/repositories/${vcs}/${slug}`,\n      httpErrors: {\n        401: 'not authorized to access project',\n        404: 'project not found',\n      },\n    })\n  }\n\n  transformBranchInfo({ json, wantedBranch }) {\n    const branch = wantedBranch || json.default_branch\n    const noBranchInfoMessage = wantedBranch\n      ? 'branch not found'\n      : 'unavailable for default branch'\n\n    const branchInfo = json.applications[branch]\n    if (!branchInfo) {\n      throw new NotFound({ prettyMessage: noBranchInfoMessage })\n    }\n\n    return branchInfo\n  }\n\n  transformBranchInfoMetricValue({ json, branch, metric }) {\n    const branchInfo = this.transformBranchInfo({ json, wantedBranch: branch })\n    if (!branchInfo.index) {\n      throw new InvalidResponse({ prettyMessage: 'metrics missing for branch' })\n    }\n    const {\n      index: {\n        _embedded: {\n          project: { metric_values: metricValues },\n        },\n      },\n    } = branchInfo\n","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/scrutinizer/scrutinizer-base.js#L6-L42","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the branch name exactly matches what Scrutinizer analyzed (check the project page on scrutinizer-ci.com)","Trigger/await a Scrutinizer build for the repo so applications data exists","URL-encode branch names containing slashes (e.g. feature%2Ffoo)","Remove the branch parameter to fall back to the default branch once it has an analysis"],"exampleFix":"// before\nhttps://img.shields.io/scrutinizer/coverage/g/user/repo/master\n// after (branch actually analyzed is 'main')\nhttps://img.shields.io/scrutinizer/coverage/g/user/repo/main","handlingStrategy":"validation","validationCode":"// Only request a branch badge for branches Scrutinizer has analyzed\nasync function branchAnalyzed(vcs, slug, branch) {\n  const res = await fetch(`https://scrutinizer-ci.com/api/repositories/${vcs}/${slug}`)\n  const repo = await res.json()\n  return Boolean(repo.applications && repo.applications[branch])\n}\nif (!(await branchAnalyzed('g', 'user/repo', 'main'))) throw new Error('branch not analyzed on Scrutinizer')","typeGuard":"function hasBranchData(json, branch) {\n  return Boolean(json && json.applications && json.applications[branch])\n}","tryCatchPattern":"try {\n  const badge = await fetchBadgeUrl(scrutinizerBadgeUrl)\n} catch (e) {\n  if (e.message === 'branch not found' || e.message === 'unavailable for default branch') {\n    console.warn('No Scrutinizer analysis for that branch; falling back to default badge')\n  } else throw e\n}","preventionTips":["Ensure the repo has at least one completed Scrutinizer build before adding badges","Match branch names exactly as shown on the Scrutinizer project page (URL-encode slashes)","Remove branch parameters for deleted/renamed branches","Re-check badges after renaming the default branch (e.g. master -> main)"],"tags":["scrutinizer","not-found","branch","badge"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}