{"record":{"id":"a616af90b75d1946","repo":"badges/shields","slug":"no-finished-builds","errorCode":null,"errorMessage":"no finished builds","messagePattern":"no finished builds","errorType":"exception","errorClass":"NotFound","httpStatus":null,"severity":"warning","filePath":"services/readthedocs/readthedocs.service.js","lineNumber":96,"sourceCode":"          url: `https://app.readthedocs.org/api/v3/projects/${encodeURIComponent(project)}/versions/${encodeURIComponent(version)}/builds/`,\n          options: {\n            searchParams: {\n              fields: 'state,success',\n              limit: 10,\n              running: false,\n            },\n          },\n        },\n        'Token',\n      ),\n    )\n  }\n\n  async handle({ project, version }) {\n    const { results } = await this.fetch({ project, version })\n    const build = results.find(({ state }) => state.code === 'finished')\n    if (!build) {\n      throw new NotFound({\n        prettyMessage: 'no finished builds',\n      })\n    }\n    return this.constructor.render({\n      status: build.success ? 'passing' : 'failing',\n    })\n  }\n}\n","sourceCodeStart":78,"sourceCodeEnd":105,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/readthedocs/readthedocs.service.js#L78-L105","documentation":"The ReadTheDocs badge throws NotFound 'no finished builds' when the API returns builds but none has state.code === 'finished'. The badge needs a completed build to compute passing/failing, so pending/errored/cancelled-only build lists yield this error.","triggerScenarios":"Requesting a badge for a project/version that has only queued, building, cancelled, or errored builds; a version identifier that maps to builds that never completed.","commonSituations":"Freshly imported projects before the first successful build; a version name (e.g. 'latest' vs actual branch) whose builds never finish; RTDocs build failures during setup; temporarily unavailable builders.","solutions":["Wait for a build to finish on ReadTheDocs, then retry the badge","Trigger a new build manually from the RTD project dashboard and verify it completes","Confirm the version parameter matches an existing RTD version with completed builds"],"exampleFix":"// before\n/badge/readthedocs/myproject/typo-branch   (never built)\n// after\n/badge/readthedocs/myproject/latest","handlingStrategy":"retry","validationCode":"const api = await fetch(`https://readthedocs.org/api/v3/projects/${project}/versions/${version}/builds`)\nconst { results } = await api.json()\nif (!results?.some(b => b.state?.code === 'finished')) throw new Error('no finished builds yet')","typeGuard":"function hasFinishedBuild(payload) {\n  return Array.isArray(payload?.results) &&\n    payload.results.some(b => b?.state?.code === 'finished')\n}","tryCatchPattern":"try {\n  return await service.handle({ project, version })\n} catch (err) {\n  if (err instanceof NotFound && err.prettyMessage === 'no finished builds') {\n    return renderBadge({ label: 'docs', message: 'building' })\n  }\n  throw err\n}","preventionTips":["Ensure RTD has completed at least one build for the version before adding the badge","Trigger a build from the RTD dashboard and confirm it finishes","Use a version slug that RTD actually builds (e.g. 'latest')"],"tags":["badge","readthedocs","no-data"],"backgroundTag":"no-build-results-yet","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}