{"record":{"id":"6e64f3126a8e30d3","repo":"oven-sh/bun","slug":"missing-sentry-id","errorCode":null,"errorMessage":"Missing sentry_id","messagePattern":"Missing sentry_id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"scripts/associate-issue-with-sentry.ts","lineNumber":11,"sourceCode":"const body = process.env.GITHUB_ISSUE_BODY;\nconst SENTRY_AUTH_TOKEN = process.env.SENTRY_AUTH_TOKEN;\n\nif (!body || !SENTRY_AUTH_TOKEN) {\n  throw new Error(\"Missing environment variables\");\n}\n\nconst id = body.indexOf(\"<!-- sentry_id: \");\nconst endIdLine = body.indexOf(\" -->\", id + 1);\nif (!(id > -1 && endIdLine > -1)) {\n  throw new Error(\"Missing sentry_id\");\n}\nconst sentryId = body.slice(id + \"<!-- sentry_id: \".length, endIdLine).trim();\nif (!sentryId) {\n  throw new Error(\"Missing sentry_id\");\n}\n\nconst response = await fetch(`https://sentry.io/api/0/organizations/4507155222364160/eventids/${sentryId}/`, {\n  headers: {\n    Authorization: `Bearer ${SENTRY_AUTH_TOKEN}`,\n  },\n});\nif (!response.ok) {\n  throw new Error(`Failed to fetch Sentry event: ${response.statusText}`);\n}\nconst json = await response.json();\nconst groupId = json?.groupId;\nif (!groupId) {\n  throw new Error(\"Missing groupId\");","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/associate-issue-with-sentry.ts#L1-L29","documentation":"The script extracts the Sentry event id from a hidden marker comment '<!-- sentry_id: ... -->' embedded in the issue body by the crash-report flow. This instance throws when indexOf cannot find the opening marker or its closing ' -->', meaning the issue body simply does not contain a Sentry event reference.","triggerScenarios":"The action ran on a manually-filed issue that never used the crash-report template; the marker was edited out of the body by a user; the body was truncated before the marker position.","commonSituations":"Workflow triggers on all new issues (on: issues) instead of only crash-report issues; users edit the template and delete the HTML comment; third-party automation files issues without the marker.","solutions":["Gate the workflow step on issues that actually carry the marker (contains(github.event.issue.body, '<!-- sentry_id:'))","Change the script to exit 0 with a log line when the marker is absent, since issues without crash data are expected","If the issue genuinely has a Sentry event, re-add the marker comment with the event id"],"exampleFix":"// before\nif (!(id > -1 && endIdLine > -1)) {\n  throw new Error('Missing sentry_id');\n}\n\n// after\nif (!(id > -1 && endIdLine > -1)) {\n  console.log('No sentry_id marker; nothing to associate');\n  process.exit(0);\n}","handlingStrategy":"validation","validationCode":"const body = process.env.GITHUB_ISSUE_BODY ?? '';\nconst hasMarker = body.indexOf('<!-- sentry_id: ') > -1 && body.indexOf(' -->', body.indexOf('<!-- sentry_id: ') + 1) > -1;\nif (!hasMarker) {\n  console.log('no sentry_id marker; skipping association');\n  process.exit(0);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate the workflow step with if: contains(github.event.issue.body, '<!-- sentry_id:')","Treat marker-less issues as a normal case (skip), not an exceptional one"],"tags":["sentry","github-actions","parsing","ci"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}