{"record":{"id":"026958d033a03b81","repo":"badges/shields","slug":"build-pipeline-not-found","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-base.js","lineNumber":63,"sourceCode":"        $top: 1,\n        statusFilter: 'completed',\n        'api-version': '5.0-preview.4',\n      },\n    }\n\n    if (branch) {\n      options.searchParams.branchName = `refs/heads/${branch}`\n    }\n\n    const json = await this.fetch({\n      url,\n      options,\n      schema: latestBuildSchema,\n      httpErrors,\n    })\n\n    if (json.count !== 1) {\n      throw new NotFound({ prettyMessage: 'build pipeline not found' })\n    }\n\n    return json.value[0].id\n  }\n}\n","sourceCodeStart":45,"sourceCodeEnd":69,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/azure-devops/azure-devops-base.js#L45-L69","documentation":"The Azure DevOps base service fetches the latest completed build for a pipeline definition via the Azure DevOps REST API and validates the response against latestBuildSchema. It then asserts that exactly one build was returned (json.count !== 1); otherwise it throws NotFound 'build pipeline not found'. This means the pipeline definition/branch combination resolved to zero (or ambiguous) builds, so no completed build id can be used.","triggerScenarios":"Calling getLatestCompletedBuildId (via the buildId method) with an organization/project/definition combination that yields a build list whose count is not 1 — usually an unknown or deleted pipeline definition, or a definition with no completed builds on the requested branch.","commonSituations":"Wrong definitionId in the badge URL after a pipeline was deleted and recreated; wrong project or organization name; querying a branch with no completed builds; permission-restricted pipelines returning empty lists; private projects accessed without a token.","solutions":["Verify the organization, project, and definitionId in the badge URL against your Azure DevOps pipeline.","Check that the pipeline has at least one completed build on the branch being queried.","Ensure the pipeline is visible (public project, or supply a valid PAT) so the API does not return an empty result.","Recreate the badge with the correct definitionId after a pipeline was deleted/recreated."],"exampleFix":"// before\n/badge/azure-devops/build/myorg/myproj/999\n// after\n/badge/azure-devops/build/myorg/myproj/42","handlingStrategy":"validation","validationCode":"const res = await fetch(\n  `https://dev.azure.com/${org}/${project}/_apis/build/builds?definitions=${defId}&branchName=${branch}&$top=1&api-version=6.0`\n)\nconst data = await res.json()\nif (data.count !== 1) throw new Error(`No build found for definition ${defId}`)","typeGuard":null,"tryCatchPattern":"try {\n  const id = await service.buildId(params)\n} catch (e) {\n  if (e instanceof NotFound) return renderBadge('unknown pipeline')\n  throw e\n}","preventionTips":["Confirm definitionId via the Azure DevOps portal or _apis/build/definitions before embedding it in badges","Ensure the pipeline has completed builds on the queried branch","Grant read access (public project or valid PAT) so the API does not return empty results"],"tags":["azure-devops","ci","not-found","pipeline"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}