stablyai/orca · error · Error

token is required

Error message

token is required

What it means

Thrown by createDraftRelease when the token parameter is falsy. token is used as the Bearer credential in every GitHub request header (create-draft-release.mjs:127-129). In main(), it is read from process.env.GH_TOKEN || process.env.GITHUB_TOKEN, so this fires when neither env var is set.

Source

Thrown at config/scripts/create-draft-release.mjs:128

  return `${body.slice(0, availableLength).trimEnd()}${TRUNCATION_NOTICE}`
}

export async function createDraftRelease({
  repo,
  tag,
  token,
  fetchImpl = fetch,
  log = console.log
}) {
  if (!repo) {
    throw new Error('repo is required')
  }
  if (!tag) {
    throw new Error('tag is required')
  }
  if (!token) {
    throw new Error('token is required')
  }

  const previousTag = latestPreviousPublishedDesktopReleaseTag(
    await fetchRepoReleases(repo, token, fetchImpl),
    tag
  )
  const generateNotesBody = {
    tag_name: tag,
    target_commitish: tag,
    ...(previousTag ? { previous_tag_name: previousTag } : {})
  }

  // Why: GitHub's generate-notes baseline ignores draft releases, so pass the
  // previous public changelog boundary explicitly.
  const releaseNotes = await githubJson(
    fetchImpl,
    `https://api.github.com/repos/${repo}/releases/generate-notes`,
    token,

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Set GH_TOKEN (preferred) or GITHUB_TOKEN to a PAT or the CI GITHUB_TOKEN with repo/content scopes before running.
  2. In GitHub Actions, pass secrets.GITHUB_TOKEN or a PAT secret into the env.
  3. In programmatic callers, always supply a non-empty token string.

Example fix

# before
node config/scripts/create-draft-release.mjs v1.4.160
# after
export GH_TOKEN=ghp_xxx
node config/scripts/create-draft-release.mjs v1.4.160
Defensive patterns

Strategy: validation

Validate before calling

const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN
if (!token) {
  throw new Error('Set GH_TOKEN or GITHUB_TOKEN before running the release script')
}

Prevention

When it happens

Trigger: Running the script in an environment without GH_TOKEN or GITHUB_TOKEN set; calling createDraftRelease programmatically without a token; the env var present but empty string.

Common situations: Local run without exporting a PAT; CI job missing the secrets.GITHUB_TOKEN injection; a fork where the secret name differs; the token variable name typo'd in the workflow.

Related errors


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