tinyhumansai/openhuman · error · Error

${label} ref not found: ${ref}

Error message

${label} ref not found: ${ref}

What it means

assertRefExists() validates every resolved start/end ref with `git rev-parse --verify <ref>^{commit}` (allowFailure swallows the non-zero exit); when the local clone cannot resolve the ref to a commit, it throws `<label> ref not found: <ref>`. This guards the later git log range from producing garbage or empty notes.

Source

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

}

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 {
    runGit(['rev-parse', '--verify', `${ref}^{commit}`], { allowFailure: true });
  } catch {
    throw new Error(`${label} ref not found: ${ref}`);
  }
}

export function extractPullRequestNumbers(subject) {
  const matches = [...String(subject || '').matchAll(/\(#(\d+)\)/g)];
  return [...new Set(matches.map((match) => Number(match[1])).filter(Number.isInteger))];
}

export function parseGitLog(logText) {
  if (!logText.trim()) {
    return [];
  }

  return logText
    .split('\x1e')
    .map((entry) => entry.trim())
    .filter(Boolean)
    .map((entry) => {

View on GitHub (pinned to a221052e0d)

Solutions

  1. Fetch full tags/history: git fetch --tags origin (add --unshallow in shallow CI clones), then re-run
  2. Confirm the ref resolves exactly as the script does: git rev-parse --verify '<ref>^{commit}' must print a SHA
  3. Use fully-qualified refs: origin/main instead of main, or the full 40-char SHA
  4. Check spelling against git tag --list

Example fix

# before (CI shallow clone, tag not fetched)
- run: node scripts/release/generate-release-notes.mjs --from v1.2.3

# after
- run: git fetch --tags --unshallow origin
- run: node scripts/release/generate-release-notes.mjs --from v1.2.3
Defensive patterns

Strategy: validation

Validate before calling

git fetch --tags origin >/dev/null 2>&1
for ref in "$FROM" "${TO:-latest-tag}"; do
  [ "$ref" = 'latest-tag' ] && ref=$(git describe --tags --abbrev=0)
  git rev-parse --verify --quiet "${ref}^{commit}" >/dev/null \
    || { echo "ref '$ref' not resolvable locally" >&2; exit 1; }
done

Prevention

When it happens

Trigger: A --from/--to value that does not exist locally: a tag that was never fetched, a remote-only branch given without the origin/ prefix, a typo'd or truncated SHA, or a release tag resolved from GitHub that lies outside a shallow clone's history.

Common situations: CI checkouts with fetch-depth: 1 or --no-tags so rev-parse cannot see the tag; fresh local clones; copying a tag name from a different fork; using main when only origin/main exists in detached-HEAD CI contexts.

Related errors


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