stablyai/orca · error · Error

token is required

Error message

token is required

What it means

fetchReleases requires a non-empty token and throws 'token is required' before issuing any request when it is falsy, since every githubJson call sends Authorization: Bearer <token> and an empty bearer yields an opaque 401. The CLI entrypoint reads GH_TOKEN then GITHUB_TOKEN.

Source

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

    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) {
      break
    }
  }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Set GH_TOKEN (preferred) or GITHUB_TOKEN to a valid PAT or GITHUB_TOKEN.
  2. In CI, confirm the secret is referenced in the step's env block.
  3. Check for a typo in the env var name.

Example fix

# before
# (neither set)
node config/scripts/latest-stable-release.mjs

# after
export GH_TOKEN=$(gh auth token)
node config/scripts/latest-stable-release.mjs
Defensive patterns

Strategy: validation

Validate before calling

const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN
if (!token) throw new Error('GH_TOKEN or GITHUB_TOKEN is required')

Prevention

When it happens

Trigger: Calling fetchReleases(repo, '') or fetchReleases(repo, undefined); running main() with both GH_TOKEN and GITHUB_TOKEN unset.

Common situations: CI secret not injected (wrong secret name, not exposed to the step); token env var typo; running the script locally without exporting a token.

Related errors


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