OtterMind/Chat2DB · error · Error

GITHUB_EVENT_PATH is required.

Error message

GITHUB_EVENT_PATH is required.

What it means

issue-claim.js throws this when invoked in 'event' or 'cleanup' mode without the GITHUB_EVENT_PATH environment variable set. GITHUB_EVENT_PATH is a standard GitHub Actions variable that points to the JSON file containing the webhook event payload. Without it, the script cannot read the event data (issue number, action, comment body) needed to process or clean up a claim.

Source

Thrown at script/github/issue-claim.js:714

    throw error;
  }
  return reason;
}

async function main() {
  const mode = process.argv[2];
  const policyPath = process.env.CLAIM_POLICY_PATH
    || path.resolve(process.cwd(), '.github/claim-policy.json');
  const policy = loadPolicy(policyPath);
  const client = new GitHubClient({
    token: process.env.GITHUB_TOKEN,
    repository: process.env.GITHUB_REPOSITORY,
    apiUrl: process.env.GITHUB_API_URL,
    graphqlUrl: process.env.GITHUB_GRAPHQL_URL,
  });

  if (mode === 'event') {
    if (!process.env.GITHUB_EVENT_PATH) throw new Error('GITHUB_EVENT_PATH is required.');
    const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
    const result = await processEvent({ client, policy, event });
    console.log(`Claim command result: ${result}`);
    return;
  }
  if (mode === 'sweep') {
    const released = await sweepExpiredClaims({ client, policy });
    console.log(`Released ${released} expired claim(s).`);
    return;
  }
  if (mode === 'cleanup') {
    if (!process.env.GITHUB_EVENT_PATH) throw new Error('GITHUB_EVENT_PATH is required.');
    const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));
    const result = await cleanupClaim({ client, policy, event });
    console.log(`Claim cleanup result: ${result}`);
    return;
  }
  throw new Error('Usage: node script/github/issue-claim.js <event|cleanup|sweep>');

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Set GITHUB_EVENT_PATH to a local JSON file containing the event payload: GITHUB_EVENT_PATH=./test-event.json node script/github/issue-claim.js event.
  2. Ensure the GitHub Actions workflow runs the script in the default runner context where GITHUB_EVENT_PATH is automatically set.
  3. Pass the env var explicitly in the workflow step if using a container action: env: GITHUB_EVENT_PATH: ${{ github.event_path }}.

Example fix

// before
GITHUB_EVENT_PATH= node script/github/issue-claim.js event
# → throws 'GITHUB_EVENT_PATH is required.'

// after
GITHUB_EVENT_PATH=./fixtures/issue-comment-event.json \
GITHUB_TOKEN=ghp_xxx \
GITHUB_REPOSITORY=owner/repo \
node script/github/issue-claim.js event
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.GITHUB_EVENT_PATH) {
  throw new Error('GITHUB_EVENT_PATH is required. Set it to the webhook event JSON file path.');
}
const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));

Prevention

When it happens

Trigger: Running `node script/github/issue-claim.js event` or `node script/github/issue-claim.js cleanup` outside of a GitHub Actions runner where GITHUB_EVENT_PATH is not set. Also if the GitHub Actions workflow forgot to pass the env var, or the script is run locally for testing without setting it.

Common situations: Local development/testing of the claim script without GitHub Actions context. A workflow job that uses a different runner or container without forwarding GITHUB_EVENT_PATH. Running the script manually via SSH on a server.

Related errors


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/831e1856ae96b1a1. Report an issue: GitHub.