oven-sh/bun · error

GITHUB_ISSUE_BODY must be set

Error message

GITHUB_ISSUE_BODY must be set

What it means

scripts/is-outdated.ts reads GITHUB_ISSUE_BODY to find the reporter's Bun version line and compare against LATEST; it throws immediately when the env var is unset. Note that an issue with a genuinely empty body ('') is also falsy and triggers this.

Source

Thrown at scripts/is-outdated.ts:4

import { join } from "path";
const body = process.env.GITHUB_ISSUE_BODY;
if (!body) {
  throw new Error("GITHUB_ISSUE_BODY must be set");
}

const latest = (await Bun.file(join(import.meta.dir, "..", "LATEST")).text()).trim();

// Check if this is a standalone executable
const isStandalone = body.includes("standalone_executable");

const lines = body.split("\n").reverse();

for (let line of lines) {
  line = line.trim().toLowerCase();
  if (line.startsWith("bun v") && line.includes(" on ")) {
    const version = line.slice("bun v".length, line.indexOf(" ", "bun v".length)).toLowerCase().trim();

    // Check if valid version
    if (version.includes("canary")) {
      process.exit(0);
    }

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Set `GITHUB_ISSUE_BODY: ${{ github.event.issue.body }}` in the step env
  2. Gate the step with an issue-event condition so empty-context runs skip it
  3. Treat empty body as a no-op instead: exit 0 early when body is missing but the event is not an issue
  4. For local testing, export a representative body containing a 'bun v1.x.x on ...' line

Example fix

// before
const body = process.env.GITHUB_ISSUE_BODY;
if (!body) {
  throw new Error('GITHUB_ISSUE_BODY must be set');
}

// after
const body = process.env.GITHUB_ISSUE_BODY;
if (!body) {
  if (process.env.GITHUB_ACTIONS) throw new Error('GITHUB_ISSUE_BODY must be set');
  console.error('not running in an issue context; nothing to do');
  process.exit(0);
}
Defensive patterns

Strategy: validation

Validate before calling

const body = process.env.GITHUB_ISSUE_BODY;
if (!body) {
  if (!process.env.GITHUB_ACTIONS) {
    console.error('GITHUB_ISSUE_BODY not set; not running inside an issue event');
    process.exit(0);
  }
  throw new Error('GITHUB_ISSUE_BODY must be set');
}

Prevention

When it happens

Trigger: Executing the script outside an issues/issue_comment Action context; the workflow env block omitting GITHUB_ISSUE_BODY; the triggering issue having an empty body; local invocation without exports.

Common situations: Manual local runs; workflow trigger changed from issues to something without a body; bot-filed issues with empty bodies.

Related errors


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