{"record":{"id":"b8f45c1a62c3a0ad","repo":"badges/shields","slug":"no-commits-found","errorCode":null,"errorMessage":"no commits found","messagePattern":"no commits found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/bitbucket/bitbucket-last-commit.service.js","lineNumber":69,"sourceCode":"          path,\n          pagelen: 1,\n          fields: 'values.date',\n        },\n      },\n      schema,\n      httpErrors: {\n        403: 'private repo',\n        404: 'user, repo or branch not found',\n      },\n    })\n  }\n\n  async handle({ user, repo, branch }, queryParams) {\n    const { path } = queryParams\n    const data = await this.fetch({ user, repo, branch, path })\n    const [commit] = data.values\n\n    if (!commit) throw new NotFound({ prettyMessage: 'no commits found' })\n\n    return renderDateBadge(commit.date)\n  }\n}\n","sourceCodeStart":51,"sourceCodeEnd":74,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/bitbucket/bitbucket-last-commit.service.js#L51-L74","documentation":"The Bitbucket last-commit service fetches the commit list for a repository/branch/path and destructures the first entry from data.values. If the list is empty (no commit found), handle throws NotFound 'no commits found', so the badge reports that the requested branch/path has no commits instead of crashing.","triggerScenarios":"Requesting the last-commit badge for a Bitbucket repo/branch/path combination where the commits API returns an empty values array — typically a nonexistent branch name or a path filter that no commit touches.","commonSituations":"Branch renamed or deleted (e.g. master → main migration); typo in the branch parameter; path parameter pointing at a file/dir that does not exist on that branch; empty repository.","solutions":["Verify the branch name in the badge URL against the repository's branches.","Remove or correct the path query parameter if it filters out all commits.","Confirm the repository is public/accessible so the API returns real data.","Update badges after master→main or other branch renames."],"exampleFix":"// before\n/badge/bitbucket/last-commit/user/repo/old-branch\n// after\n/badge/bitbucket/last-commit/user/repo/main","handlingStrategy":"validation","validationCode":"const res = await fetch(\n  `https://api.bitbucket.org/2.0/repositories/${user}/${repo}/commits/${branch}`\n)\nif (!res.ok) throw new Error(`Branch '${branch}' not found on ${user}/${repo}`)\nconst data = await res.json()\nif (!data.values?.length) throw new Error('No commits on this branch/path')","typeGuard":null,"tryCatchPattern":"try {\n  return await lastCommitBadge({ user, repo, branch })\n} catch (e) {\n  if (e instanceof NotFound) return renderBadge('no commits')\n  throw e\n}","preventionTips":["Verify branch names after master→main migrations","Drop the path filter if it excludes every commit","Check the repo is public/accessible before relying on its badges"],"tags":["bitbucket","git","not-found","commits","branch"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}