{"record":{"id":"831e1856ae96b1a1","repo":"OtterMind/Chat2DB","slug":"github-event-path-is-required","errorCode":null,"errorMessage":"GITHUB_EVENT_PATH is required.","messagePattern":"GITHUB_EVENT_PATH is required\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"script/github/issue-claim.js","lineNumber":714,"sourceCode":"    throw error;\n  }\n  return reason;\n}\n\nasync function main() {\n  const mode = process.argv[2];\n  const policyPath = process.env.CLAIM_POLICY_PATH\n    || path.resolve(process.cwd(), '.github/claim-policy.json');\n  const policy = loadPolicy(policyPath);\n  const client = new GitHubClient({\n    token: process.env.GITHUB_TOKEN,\n    repository: process.env.GITHUB_REPOSITORY,\n    apiUrl: process.env.GITHUB_API_URL,\n    graphqlUrl: process.env.GITHUB_GRAPHQL_URL,\n  });\n\n  if (mode === 'event') {\n    if (!process.env.GITHUB_EVENT_PATH) throw new Error('GITHUB_EVENT_PATH is required.');\n    const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));\n    const result = await processEvent({ client, policy, event });\n    console.log(`Claim command result: ${result}`);\n    return;\n  }\n  if (mode === 'sweep') {\n    const released = await sweepExpiredClaims({ client, policy });\n    console.log(`Released ${released} expired claim(s).`);\n    return;\n  }\n  if (mode === 'cleanup') {\n    if (!process.env.GITHUB_EVENT_PATH) throw new Error('GITHUB_EVENT_PATH is required.');\n    const event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));\n    const result = await cleanupClaim({ client, policy, event });\n    console.log(`Claim cleanup result: ${result}`);\n    return;\n  }\n  throw new Error('Usage: node script/github/issue-claim.js <event|cleanup|sweep>');","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/script/github/issue-claim.js#L696-L732","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Ensure the GitHub Actions workflow runs the script in the default runner context where GITHUB_EVENT_PATH is automatically set.","Pass the env var explicitly in the workflow step if using a container action: env: GITHUB_EVENT_PATH: ${{ github.event_path }}."],"exampleFix":"// before\nGITHUB_EVENT_PATH= node script/github/issue-claim.js event\n# → throws 'GITHUB_EVENT_PATH is required.'\n\n// after\nGITHUB_EVENT_PATH=./fixtures/issue-comment-event.json \\\nGITHUB_TOKEN=ghp_xxx \\\nGITHUB_REPOSITORY=owner/repo \\\nnode script/github/issue-claim.js event","handlingStrategy":"validation","validationCode":"if (!process.env.GITHUB_EVENT_PATH) {\n  throw new Error('GITHUB_EVENT_PATH is required. Set it to the webhook event JSON file path.');\n}\nconst event = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the claim script inside a GitHub Actions job where GITHUB_EVENT_PATH is set automatically.","For local testing, create a fixture JSON file and export GITHUB_EVENT_PATH pointing to it.","Document required environment variables (GITHUB_EVENT_PATH, GITHUB_TOKEN, GITHUB_REPOSITORY) in the script's usage."],"tags":["github","automation","environment","config","node"],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}