Hmbown/CodeWhale · error · Error

Invalid GitHub repository: ${repo}

Error message

Invalid GitHub repository: ${repo}

What it means

validateTarget() in scripts/release/ensure-release-assets-absent.js rejected the repository argument before any network call: it must match OWNER/REPO where each part contains only A-Z a-z 0-9 _ . and -. Spaces, URL forms, extra path segments, and .git suffixes all fail this strict shape check.

Source

Thrown at scripts/release/ensure-release-assets-absent.js:11

#!/usr/bin/env node

const { execFileSync } = require("node:child_process");

function usage() {
  return "Usage: node scripts/release/ensure-release-assets-absent.js OWNER/REPO vX.Y.Z";
}

function validateTarget(repo, tag) {
  if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo)) {
    throw new Error(`Invalid GitHub repository: ${repo}`);
  }
  if (!/^v[0-9]+\.[0-9]+\.[0-9]+$/.test(tag)) {
    throw new Error(`Invalid release tag: ${tag}`);
  }
}

function isNotFoundError(error) {
  return (
    error &&
    error.status !== 0 &&
    /\bHTTP 404\b/.test(String(error.stderr || ""))
  );
}

function fetchRelease(repo, tag, ghBin = process.env.GH_BIN || "gh", exec = execFileSync) {
  validateTarget(repo, tag);
  const endpoint = `repos/${repo}/releases/tags/${encodeURIComponent(tag)}`;
  let output;

View on GitHub (pinned to 8880682c63)

Solutions

  1. Pass the bare slug exactly as OWNER/REPO, e.g. acme/codewhale — in GitHub Actions derive it from the GITHUB_REPOSITORY env var
  2. If your source is a URL, strip the scheme, host, and .git suffix before invoking

Example fix

# before
node scripts/release/ensure-release-assets-absent.js https://github.com/acme/codewhale v1.2.3

# after
node scripts/release/ensure-release-assets-absent.js acme/codewhale v1.2.3
Defensive patterns

Strategy: validation

Validate before calling

function isValidGithubRepo(repo) {
  return /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repo);
}
// before invoking:
if (!isValidGithubRepo(repo)) throw new Error(`pass OWNER/REPO (got ${repo})`);

Prevention

When it happens

Trigger: Passing 'https://github.com/acme/codewhale', 'github.com/acme/codewhale.git', 'acme/codewhale/extra', an empty string, or any value with spaces/unicode as the first CLI argument.

Common situations: Copy-pasting from the browser URL bar; forwarding a repository env var that carries a prefix or .git; a template variable producing an empty owner in CI.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/8843e82b44c59dbe. Report an issue: GitHub.