oven-sh/bun · error · Error

GitHub API returned ${res.status}; cannot determine changed

Error message

GitHub API returned ${res.status}; cannot determine changed files

What it means

Error "GitHub API returned ${res.status}; cannot determine changed files" thrown in oven-sh/bun.

Source

Thrown at scripts/runner.node.mjs:258

      console.error("Failed to parse pr-*-files meta-data:", e);
      allFiles = [];
      newFiles = [];
    }
  }
  if (allFiles.length === 0) {
    try {
      console.log("on buildkite: collecting new files from PR");
      const per_page = 50;
      const { BUILDKITE_PULL_REQUEST } = process.env;
      for (let i = 1; i <= 10; i++) {
        const res = await fetch(
          `https://api.github.com/repos/oven-sh/bun/pulls/${BUILDKITE_PULL_REQUEST}/files?per_page=${per_page}&page=${i}`,
          { headers: { Authorization: `Bearer ${getSecret("GITHUB_TOKEN")}` } },
        );
        const doc = await res.json();
        if (!res.ok || !Array.isArray(doc)) {
          console.error(`-> page ${i}: GitHub API ${res.status} ${res.statusText}:`, JSON.stringify(doc));
          throw new Error(`GitHub API returned ${res.status}; cannot determine changed files`);
        }
        console.log(`-> page ${i}, found ${doc.length} items`);
        if (doc.length === 0) break;
        for (const { filename, status } of doc) {
          prFileCount += 1;
          allFiles.push(filename);
          if (status !== "added") continue;
          newFiles.push(filename);
        }
        if (doc.length < per_page) break;
      }
      console.log(`- PR ${BUILDKITE_PULL_REQUEST}, ${prFileCount} files, ${newFiles.length} new files`);
    } catch (e) {
      console.error(e);
    }
  }
}

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at scripts/runner.node.mjs:258 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/2d8b4e23f5109926. Report an issue: GitHub.