{"record":{"id":"893d212bba551253","repo":"badges/shields","slug":"build-pipeline-not-found-893d21","errorCode":null,"errorMessage":"build pipeline not found","messagePattern":"build pipeline not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/azure-devops/azure-devops-build.service.js","lineNumber":209,"sourceCode":"        definitions: definitionId,\n        $top: 1,\n        statusFilter: 'completed',\n        'api-version': '5.0-preview.4',\n      },\n    }\n    if (branch) {\n      options.searchParams.branchName = `refs/heads/${branch}`\n    }\n\n    const { count, value } = await this.fetch({\n      url,\n      options,\n      schema: buildSchema,\n      httpErrors,\n    })\n\n    if (count !== 1) {\n      throw new NotFound({ prettyMessage: 'build pipeline not found' })\n    }\n\n    const result =\n      stage || job\n        ? await this.getStageOrJobResult(\n            organization,\n            projectId,\n            value[0].id,\n            stage,\n            job,\n            httpErrors,\n          )\n        : value[0].result\n    const status = this.constructor.resultMap[result] || result\n    return renderBuildStatusBadge({ status })\n  }\n}\n","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/azure-devops/azure-devops-build.service.js#L191-L227","documentation":"The Azure DevOps build status handler fetches the build list, validates it against buildSchema, and requires exactly one matching build (count !== 1) before resolving stage/job results. When the count is anything else it throws NotFound 'build pipeline not found', meaning the requested definition/branch combination did not resolve to a single build.","triggerScenarios":"Requesting the azure-devops build status badge where the build list API returns count !== 1 for the given definition and branch filter — an invalid definitionId, a branch with no builds, or an inaccessible project yields zero results.","commonSituations":"Badge URL pointing at a deleted or renamed pipeline; misspelled branch parameter (branch names must be URL-encoded, e.g. refs/heads/main); private pipelines without auth returning empty counts; querying before the first build ever ran.","solutions":["Verify the definitionId, project, and organization in the badge URL.","URL-encode the branch parameter correctly (e.g. branch=refs/heads/main).","Ensure the pipeline has at least one build and that it is accessible (public or with a valid token).","Update the badge after pipelines are deleted or moved to another project."],"exampleFix":"// before\n.../build/myorg/myproj/7?branch=main\n// after\n.../build/myorg/myproj/7?branch=refs%2Fheads%2Fmain","handlingStrategy":"validation","validationCode":"const branch = encodeURIComponent('refs/heads/main')\nconst res = await fetch(\n  `https://dev.azure.com/${org}/${project}/_apis/build/builds?definitions=${defId}&branchName=${branch}&api-version=6.0`\n)\nif ((await res.json()).count !== 1) throw new Error('Pipeline/branch combo has no build')","typeGuard":null,"tryCatchPattern":"try {\n  return await buildStatusBadge(params)\n} catch (e) {\n  if (e instanceof NotFound) return renderBadge('pipeline not found')\n  throw e\n}","preventionTips":["URL-encode branch names (refs/heads/main) in badge URLs","Verify definitionId and project after pipeline deletions/moves","Run at least one build before publishing the badge"],"tags":["azure-devops","ci","not-found","pipeline","branch"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}