stablyai/orca · error

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

Error message

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

What it means

Thrown by the release asset verification script's fetchRelease function when the JSON body of the GitHub releases list endpoint is not a JavaScript array. The releases API endpoint (GET /repos/{repo}/releases) normally returns an array of release objects, so a non-array response indicates an unexpected API response shape — typically an error object (when auth failed but somehow passed the res.ok check, or a redirect/HTML response), or a GitHub API versioning change.

Source

Thrown at config/scripts/verify-release-required-assets.mjs:70

    headers: {
      Accept: accept,
      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
}

async function fetchRelease(repo, tag, token) {
  // The publish gate runs while the release is still draft.
  const res = await githubFetch(`https://api.github.com/repos/${repo}/releases?per_page=100`, token)
  const releases = await res.json()
  if (!Array.isArray(releases)) {
    throw new Error(`GitHub releases response for ${repo} was not an array`)
  }
  const release = releases.find((candidate) => candidate.tag_name === tag)
  if (!release) {
    throw new Error(`Release ${repo}@${tag} was not found in the draft-aware releases list`)
  }
  return release
}

async function fetchAssetText(repo, asset, token) {
  const res = await githubFetch(
    `https://api.github.com/repos/${repo}/releases/assets/${asset.id}`,
    token,
    'application/octet-stream'
  )
  return res.text()
}

export async function verifyRequiredReleaseAssets({ repo, tag, token }) {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Log the actual response body to see what shape was returned: add console.error(await res.text()) before the json() call in a debug build.
  2. Verify the X-GitHub-Api-Version header value (2022-11-28) is still supported by checking GitHub's API changelog.
  3. Check for proxy interference: if behind a corporate proxy, verify it passes through GitHub API responses unmodified.
  4. If the response is an error object (e.g., { message: '...' }), the preceding githubFetch check should have caught it — investigate why res.ok was true for an error response.
  5. Add a more specific type check that includes a helpful diagnostic: if (!Array.isArray(releases)) throw new Error(`Expected array, got ${typeof releases}: ${JSON.stringify(releases).slice(0, 200)}`).

Example fix

// before
//   const releases = await res.json()
//   if (!Array.isArray(releases)) {
//     throw new Error(`GitHub releases response for ${repo} was not an array`)
//   }
//
// after — include the actual response for diagnostics
//   const body = await res.json()
//   if (!Array.isArray(body)) {
//     throw new Error(`GitHub releases response for ${repo} was not an array (got ${typeof body}): ${JSON.stringify(body).slice(0, 200)}`)
//   }
//   const releases = body
Defensive patterns

Strategy: type-guard

Type guard

// Narrow that a GitHub releases response is the expected array shape.
function isReleasesArray(value) {
  return Array.isArray(value) && value.every(
    (item) => typeof item === 'object' && item !== null && typeof item.tag_name === 'string'
  )
}

Try / catch

// Parse the body once, validate the shape, and include diagnostics on failure.
const body = await res.json()
if (!isReleasesArray(body)) {
  const bodyType = Array.isArray(body) ? `array of ${body.length} non-release items` : typeof body
  throw new Error(
    `GitHub releases response for ${repo} was not a valid releases array (got ${bodyType}): ${JSON.stringify(body).slice(0, 200)}`
  )
}
const releases = body

Prevention

When it happens

Trigger: fetchRelease calls githubFetch which returns res.ok=true (2xx), then res.json() produces a non-array. This can occur if GitHub returns an object with an error property instead of an array (some edge cases with deprecated API versions), if the response was an HTML redirect page that happened to be 200, or if a proxy/interceptor altered the response.

Common situations: The X-GitHub-Api-Version header points to a deprecated or preview API version that returns a different response shape; a corporate proxy or man-in-the-middle intercept returns HTML instead of JSON; GitHub returns a 200 with an error object for certain edge cases (e.g., repo archived); the API_VERSION constant (2022-11-28) becomes outdated after a GitHub API deprecation.

Related errors


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