{"record":{"id":"86815d8068af457d","repo":"oven-sh/bun","slug":"invalid-github-repository-format-repository","errorCode":null,"errorMessage":"Invalid GITHUB_REPOSITORY format: ${repository}","messagePattern":"Invalid GITHUB_REPOSITORY format: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/auto-close-duplicates.ts","lineNumber":229,"sourceCode":"\n🤖 Generated with [Claude Code](https://claude.ai/code)`,\n  });\n}\n\nasync function autoCloseDuplicates(): Promise<void> {\n  console.log(\"[DEBUG] Starting auto-close duplicates script\");\n\n  const token = process.env.GITHUB_TOKEN;\n  if (!token) {\n    throw new Error(\"GITHUB_TOKEN environment variable is required\");\n  }\n  console.log(\"[DEBUG] GitHub token found\");\n\n  // Parse GITHUB_REPOSITORY (format: \"owner/repo\")\n  const repository = process.env.GITHUB_REPOSITORY || \"oven-sh/bun\";\n  const [owner, repo] = repository.split(\"/\");\n  if (!owner || !repo) {\n    throw new Error(`Invalid GITHUB_REPOSITORY format: ${repository}`);\n  }\n  console.log(`[DEBUG] Repository: ${owner}/${repo}`);\n\n  const threeDaysAgo = new Date();\n  threeDaysAgo.setDate(threeDaysAgo.getDate() - 3);\n  console.log(`[DEBUG] Checking for duplicate comments older than: ${threeDaysAgo.toISOString()}`);\n\n  console.log(\"[DEBUG] Fetching open issues created more than 3 days ago...\");\n  const allIssues: GitHubIssue[] = [];\n  let page = 1;\n  const perPage = 100;\n\n  while (true) {\n    const pageIssues: GitHubIssue[] = await githubRequest(\n      `/repos/${owner}/${repo}/issues?state=open&per_page=${perPage}&page=${page}`,\n      token,\n    );\n","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/auto-close-duplicates.ts#L211-L247","documentation":"GITHUB_REPOSITORY must decompose as 'owner/repo' via split('/'). The variable defaults to 'oven-sh/bun', so this only throws when the env var IS set but malformed — e.g. it contains no slash ('bun') or an empty component ('oven-sh/').","triggerScenarios":"A runner or workflow sets GITHUB_REPOSITORY to just the repo name or a URL; manual invocation exporting a wrong value; trailing content after the second component is tolerated but a missing/empty owner or repo is not.","commonSituations":"Custom self-hosted runner not injecting the standard GITHUB_REPOSITORY; script reused in another repo with a hand-written env value.","solutions":["Set GITHUB_REPOSITORY to the exact 'owner/repo' form (e.g. oven-sh/bun)","In Actions, pass ${{ github.repository }} rather than typing it manually","Unset the variable to fall back to the default 'oven-sh/bun'"],"exampleFix":"# before\nGITHUB_REPOSITORY=bun bun scripts/auto-close-duplicates.ts\n\n# after\nGITHUB_REPOSITORY=oven-sh/bun bun scripts/auto-close-duplicates.ts","handlingStrategy":"validation","validationCode":"const repository = process.env.GITHUB_REPOSITORY ?? 'oven-sh/bun';\nif (!/^[^/\\s]+\\/[^/\\s]+$/.test(repository)) {\n  throw new Error(`GITHUB_REPOSITORY must be 'owner/repo', got: ${repository}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass ${{ github.repository }} instead of hand-typing the value","Validate the owner/repo shape once at startup with a regex"],"tags":["github-api","environment-variables","validation","configuration"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}