stablyai/orca · error · Error

repo is required

Error message

repo is required

What it means

fetchReleases requires a non-empty repo slug (e.g. 'stablyai/orca') and throws 'repo is required' before issuing any request when it is falsy. This guards against building a malformed API URL and getting a confusing 404. The CLI entrypoint defaults repo to GITHUB_REPOSITORY or 'stablyai/orca'.

Source

Thrown at config/scripts/latest-stable-release.mjs:49

async function githubJson(fetchImpl, url, token) {
  const res = await fetchImpl(url, {
    headers: {
      Accept: 'application/vnd.github+json',
      Authorization: `Bearer ${token}`,
      'X-GitHub-Api-Version': API_VERSION
    }
  })
  if (!res.ok) {
    const body = await res.text().catch(() => '')
    throw new Error(`GitHub request failed ${res.status} ${res.statusText}: ${body.slice(0, 300)}`)
  }
  return res.json()
}

export async function fetchReleases(repo, token, fetchImpl = fetch) {
  if (!repo) {
    throw new Error('repo is required')
  }
  if (!token) {
    throw new Error('token is required')
  }

  const releases = []
  for (let page = 1; ; page += 1) {
    const pageReleases = await githubJson(
      fetchImpl,
      `https://api.github.com/repos/${repo}/releases?per_page=100&page=${page}`,
      token
    )
    if (!Array.isArray(pageReleases)) {
      throw new Error(`GitHub releases response page ${page} for ${repo} was not an array`)
    }

    releases.push(...pageReleases)
    if (pageReleases.length < 100) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Pass a non-empty 'owner/name' repo slug.
  2. Set GITHUB_REPOSITORY in the environment (the CLI default uses it).
  3. Validate the slug upstream before calling fetchReleases.

Example fix

// before
await fetchReleases('', token)

// after
const repo = process.env.GITHUB_REPOSITORY || 'stablyai/orca'
await fetchReleases(repo, token)
Defensive patterns

Strategy: validation

Validate before calling

const repo = process.env.GITHUB_REPOSITORY || 'stablyai/orca'
if (!repo || !/^[^/\s]+\/[^/\s]+$/.test(repo)) {
  throw new Error(`Invalid or missing repo slug: ${String(repo)}`)
}

Type guard

function isRepoSlug(value: unknown): value is string {
  return typeof value === 'string' && /^[^/\s]+\/[^/\s]+$/.test(value)
}

Prevention

When it happens

Trigger: Calling fetchReleases('', token) or fetchReleases(undefined, token); running main() with GITHUB_REPOSITORY unset would still fall through to the default, so a direct caller passing empty is the usual cause.

Common situations: A caller computing the repo slug from config that resolved to undefined; GITHUB_REPOSITORY intentionally cleared and no fallback passed.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/f5488027127bd08e. Report an issue: GitHub.