stablyai/orca · error · Error

GitHub releases response page ${page} for ${repo} was not an

Error message

GitHub releases response page ${page} for ${repo} was not an array

What it means

Thrown by fetchRepoReleases when a paginated GitHub releases response succeeds (res.ok) but the parsed JSON is not an Array. GitHub's releases endpoint normally returns an array; a non-array 2xx body indicates an unexpected API/proxy shape (create-draft-release.mjs:82-99).

Source

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

    }
  })
  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()
}

async function fetchRepoReleases(repo, token, fetchImpl) {
  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
    }
  }
  return releases
}

export function truncateReleaseBody(body, maxLength = MAX_RELEASE_BODY_LENGTH) {
  if (body.length <= maxLength) {
    return body
  }

  const availableLength = maxLength - TRUNCATION_NOTICE.length
  if (availableLength <= 0) {
    throw new Error('Release truncation notice is longer than the maximum release body length')
  }

View on GitHub (pinned to 1136503c6a)

Solutions

  1. If using a custom fetchImpl (e.g., in tests), ensure it returns a raw array for the releases endpoint, matching the real GitHub API.
  2. Verify the script runs against api.github.com or a compatible GitHub Enterprise endpoint.
  3. Inspect the actual response body to confirm whether a proxy is wrapping it.

Example fix

// before (test mock returning wrapped object)
fetchImpl = async () => ({ ok: true, json: async () => ({ releases: [] }) })
// after (mock returns a raw array)
fetchImpl = async () => ({ ok: true, json: async () => [] })
Defensive patterns

Strategy: type-guard

Validate before calling

async function releasesAreArray(repo, token, fetchImpl = fetch) {
  const res = await fetchImpl(
    `https://api.github.com/repos/${repo}/releases?per_page=1`,
    { headers: { Authorization: `Bearer ${token}`, Accept: 'application/vnd.github+json' } }
  )
  if (!res.ok) return false
  return Array.isArray(await res.json())
}

Type guard

function isReleasesArray(body) {
  return Array.isArray(body)
}

Prevention

When it happens

Trigger: A corporate proxy or GitHub Enterprise gateway returning a wrapped object instead of a raw array; GitHub returning an error envelope that still carries a 2xx status (rare); a mocked fetchImpl in tests returning { releases: [...] } instead of [...].

Common situations: Test mocks that wrap the response in an object; GitHub Enterprise Server versions with non-standard response shapes; a man-in-the-middle proxy rewriting JSON; pointing the script at a non-GitHub-compatible API.

Related errors


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