Hmbown/CodeWhale · error · Error

Could not inspect GitHub Release ${tag}: ${detail}

Error message

Could not inspect GitHub Release ${tag}: ${detail}

What it means

The `gh api repos/<repo>/releases/tags/<tag>` subprocess failed with something other than an HTTP 404 (404 means 'no release yet' and returns null). The trimmed stderr is appended as detail. Typical causes: expired or missing gh authentication (401), rate limiting (403), network failure, or gh not installed / GH_BIN mispointed (which yields an error with empty stderr and no detail).

Source

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

  );
}

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;
  try {
    output = exec(ghBin, ["api", endpoint], {
      encoding: "utf8",
      maxBuffer: 10 * 1024 * 1024,
      stdio: ["ignore", "pipe", "pipe"],
    });
  } catch (error) {
    if (isNotFoundError(error)) {
      return null;
    }
    const detail = String(error && error.stderr ? error.stderr : "").trim();
    throw new Error(
      `Could not inspect GitHub Release ${tag}${detail ? `: ${detail}` : ""}`,
    );
  }

  try {
    return JSON.parse(output);
  } catch (error) {
    throw new Error(`GitHub Release ${tag} returned invalid JSON: ${error.message}`);
  }
}

function assertReleaseAssetsAbsent(release, tag) {
  if (release === null) {
    return;
  }
  if (!release || !Array.isArray(release.assets)) {
    throw new Error(`GitHub Release ${tag} did not provide an asset inventory`);
  }

View on GitHub (pinned to 8880682c63)

Solutions

  1. Run `gh auth status` with the same token environment to confirm authentication and scopes
  2. Read the appended stderr detail — it contains gh's actual HTTP error line
  3. If rate-limited or network-blipped, wait out the window and re-run the script (it is idempotent; 404/absent is the success path)
  4. Confirm gh is installed and GH_BIN (if set) points to the real gh binary

Example fix

# before: token missing -> Could not inspect GitHub Release v1.2.3: HTTP 401
node scripts/release/ensure-release-assets-absent.js acme/codewhale v1.2.3

# after
GH_TOKEN="$RELEASE_GUARD_TOKEN" node scripts/release/ensure-release-assets-absent.js acme/codewhale v1.2.3
Defensive patterns

Strategy: retry

Validate before calling

const { execFileSync } = require("node:child_process");
function ghEnvironmentIsReady() {
  try {
    execFileSync(process.env.GH_BIN || "gh", ["auth", "status"], { stdio: "ignore" });
    return true;
  } catch {
    return false;
  }
}

Try / catch

const { fetchRelease } = require("./scripts/release/ensure-release-assets-absent");
async function inspectReleaseWithRetry(repo, tag, attempts = 3) {
  for (let attempt = 0; ; attempt++) {
    try {
      return fetchRelease(repo, tag);
    } catch (error) {
      const transient = /HTTP 5\d\d|rate limit|ETIMEDOUT|ENOTFOUND|ECONNRESET/i.test(String(error.message));
      if (!transient || attempt >= attempts - 1) throw error;
      await new Promise((resolve) => setTimeout(resolve, 2 ** attempt * 5000));
    }
  }
}

Prevention

When it happens

Trigger: GH_TOKEN/GITHUB_TOKEN expired or lacking repo scope; secondary rate limit during heavy CI; runner offline or DNS broken; GH_BIN unset on an image without gh; GH_BIN pointing at a wrapper that exits non-zero.

Common situations: Token not passed to the release-guard step; a rotated PAT; a workflow burst hitting rate limits; a minimal container image missing the gh binary.

Related errors


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