{"record":{"id":"e7f1041d3c8da9a9","repo":"tinyhumansai/openhuman","slug":"could-not-resolve-latest-tag","errorCode":null,"errorMessage":"Could not resolve latest tag","messagePattern":"Could not resolve latest tag","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release/generate-release-notes.mjs","lineNumber":140,"sourceCode":"      const repo = parseGitHubRepoFromRemote(url);\n      if (repo) {\n        return repo;\n      }\n    } catch {\n      // Try the next remote.\n    }\n  }\n  throw new Error('Could not infer GitHub repo. Pass --repo owner/repo.');\n}\n\nfunction resolveEndRef(to) {\n  if (to !== 'latest-tag') {\n    return to;\n  }\n\n  const tag = runGit(['describe', '--tags', '--abbrev=0']);\n  if (!tag) {\n    throw new Error('Could not resolve latest tag');\n  }\n  return tag;\n}\n\nfunction resolveStartRef(repo, from) {\n  if (from !== 'latest-release') {\n    return from;\n  }\n\n  const tag = runGh(['release', 'view', '--repo', repo, '--json', 'tagName', '--jq', '.tagName']);\n  if (!tag) {\n    throw new Error(`Could not resolve latest GitHub Release tag for ${repo}`);\n  }\n  return tag;\n}\n\nfunction assertRefExists(ref, label) {\n  try {","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/scripts/release/generate-release-notes.mjs#L122-L158","documentation":"`--to latest-tag` is resolved via `git describe --tags --abbrev=0`, which returns the most recent reachable annotated-ish tag for HEAD. If that command prints nothing — a repository with no tags at all, or no tag reachable from the current branch (orphan branch, diverged history) — the script throws rather than proceeding with an undefined end ref.","triggerScenarios":"Fresh clone of a fork whose tags were never fetched; CI checkouts with actions/checkout fetch-depth: 1 (no tags fetched); running on a branch that has no tagged ancestor; a repo that genuinely has never cut a tag.","commonSituations":"GitHub Actions default shallow checkout; contributing from a fork before `git fetch --tags upstream`; release automation pointed at a new repo pre-first-release.","solutions":["Fetch tags then re-run: `git fetch --tags upstream && node scripts/release/generate-release-notes.mjs --from latest-release --to latest-tag`","Or pass an explicit end ref instead of the sentinel: `--to v1.42.0` (a tag, sha or branch)","In CI, set `fetch-depth: 0` (or `fetch-tags: true`) on the checkout step so describe can see tags"],"exampleFix":"# before (workflow):\n- uses: actions/checkout@v4        # default fetch-depth: 1, no tags\n- run: node scripts/release/generate-release-notes.mjs --to latest-tag\n\n# after:\n- uses: actions/checkout@v4\n  with:\n    fetch-depth: 0\n- run: node scripts/release/generate-release-notes.mjs --to latest-tag","handlingStrategy":"validation","validationCode":"import { execFileSync } from 'node:child_process';\nlet latestTag = '';\ntry {\n  latestTag = execFileSync('git', ['describe', '--tags', '--abbrev=0'], { encoding: 'utf8' }).trim();\n} catch { /* no tags reachable */ }\nif (!latestTag) {\n  console.error('No reachable tag for --to latest-tag; pass an explicit --to <ref> or fetch tags first');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In CI use actions/checkout with fetch-depth: 0 (or fetch-tags: true) before any release-notes step","Prefer explicit refs (`--from <sha> --to <tag>`) in automation; the latest-tag/latest-release sentinels are for humans on full clones","On forks, `git fetch --tags upstream` before running so describe can see the release tags"],"tags":["release","git","ci","tags"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}