tinyhumansai/openhuman · error · Error

Could not resolve latest tag

Error message

Could not resolve latest tag

What it means

`--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.

Source

Thrown at scripts/release/generate-release-notes.mjs:140

      const repo = parseGitHubRepoFromRemote(url);
      if (repo) {
        return repo;
      }
    } catch {
      // Try the next remote.
    }
  }
  throw new Error('Could not infer GitHub repo. Pass --repo owner/repo.');
}

function resolveEndRef(to) {
  if (to !== 'latest-tag') {
    return to;
  }

  const tag = runGit(['describe', '--tags', '--abbrev=0']);
  if (!tag) {
    throw new Error('Could not resolve latest tag');
  }
  return tag;
}

function resolveStartRef(repo, from) {
  if (from !== 'latest-release') {
    return from;
  }

  const tag = runGh(['release', 'view', '--repo', repo, '--json', 'tagName', '--jq', '.tagName']);
  if (!tag) {
    throw new Error(`Could not resolve latest GitHub Release tag for ${repo}`);
  }
  return tag;
}

function assertRefExists(ref, label) {
  try {

View on GitHub (pinned to a221052e0d)

Solutions

  1. Fetch tags then re-run: `git fetch --tags upstream && node scripts/release/generate-release-notes.mjs --from latest-release --to latest-tag`
  2. Or pass an explicit end ref instead of the sentinel: `--to v1.42.0` (a tag, sha or branch)
  3. In CI, set `fetch-depth: 0` (or `fetch-tags: true`) on the checkout step so describe can see tags

Example fix

# before (workflow):
- uses: actions/checkout@v4        # default fetch-depth: 1, no tags
- run: node scripts/release/generate-release-notes.mjs --to latest-tag

# after:
- uses: actions/checkout@v4
  with:
    fetch-depth: 0
- run: node scripts/release/generate-release-notes.mjs --to latest-tag
Defensive patterns

Strategy: validation

Validate before calling

import { execFileSync } from 'node:child_process';
let latestTag = '';
try {
  latestTag = execFileSync('git', ['describe', '--tags', '--abbrev=0'], { encoding: 'utf8' }).trim();
} catch { /* no tags reachable */ }
if (!latestTag) {
  console.error('No reachable tag for --to latest-tag; pass an explicit --to <ref> or fetch tags first');
  process.exit(2);
}

Prevention

When it happens

Trigger: 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.

Common situations: GitHub Actions default shallow checkout; contributing from a fork before `git fetch --tags upstream`; release automation pointed at a new repo pre-first-release.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/e7f1041d3c8da9a9. Report an issue: GitHub.