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
- Set GH_TOKEN (preferred) or GITHUB_TOKEN to a PAT or the CI GITHUB_TOKEN with repo/content scopes before running.
- In GitHub Actions, pass secrets.GITHUB_TOKEN or a PAT secret into the env.
- 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
- Inject the token via CI secrets; never hardcode it.
- Use GH_TOKEN consistently and confirm it has repo/content scopes.
- Fail the CI step early if the token env is empty.
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
- repo is required
- GitHub request failed ${res.status} ${res.statusText}: ${bod
- GitHub releases response page ${page} for ${repo} was not an
- tag is required
- --release requires a version argument, e.g. --release 1.4.16
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/1fc00cc949036916.
Report an issue: GitHub.