{"record":{"id":"86ed9685247af4e3","repo":"pbakaus/impeccable","slug":"missing-repository-pass-repo-owner-name-or-set","errorCode":null,"errorMessage":"Missing repository. Pass --repo owner/name or set GITHUB_REPOSITORY.","messagePattern":"Missing repository\\. Pass --repo owner/name or set GITHUB_REPOSITORY\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/github/sheriff.mjs","lineNumber":395,"sourceCode":"    '',\n    `If nothing changes, this PR may be closed on or after ${closeDate}. Happy to reopen when it is ready to continue.`,\n  ].join('\\n');\n}\n\nexport function staleCloseComment(pr, { waitingDays }) {\n  return [\n    CLOSE_MARKER,\n    `Closing this because it has been waiting on contributor action for ${waitingDays} days.`,\n    '',\n    'Please open a fresh PR, or ask for this one to be reopened, after the outstanding feedback is addressed.',\n  ].join('\\n');\n}\n\nexport async function main(argv = process.argv.slice(2)) {\n  const options = parseArgs(argv);\n  const repo = options.repo || process.env.GITHUB_REPOSITORY;\n  if (!repo || !repo.includes('/')) {\n    throw new Error('Missing repository. Pass --repo owner/name or set GITHUB_REPOSITORY.');\n  }\n\n  if (options.apply && options.ensureLabels) {\n    ensureLabels(repo, options);\n  }\n\n  const prs = fetchOpenPullRequests(repo).map(normalizePullRequest);\n  hydrateIssueComments(repo, prs);\n  hydrateMissingWaitingLabelEvents(repo, prs);\n  const plans = prs.map((pr) => evaluatePullRequest(pr, options));\n\n  for (const plan of plans) {\n    printPlan(plan, { apply: options.apply });\n    if (options.apply) applyPlan(repo, plan, options);\n  }\n\n  console.log(`${options.apply ? 'Applied' : 'Dry run'} sheriff pass for ${plans.length} open PR(s).`);\n}","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/pbakaus/impeccable/blob/d14711ae3d1a1dd62dee61a358d27f107c51ccd0/scripts/github/sheriff.mjs#L377-L413","documentation":"Thrown by sheriff.mjs main when neither --repo nor the GITHUB_REPOSITORY env var provides an owner/name repository string (or the value lacks a slash). Sheriff needs a concrete repo to query PRs via gh, so an absent/malformed repo is a hard stop before any GitHub call.","triggerScenarios":"Running sheriff without --repo and without GITHUB_REPOSITORY set, or with a value like 'myrepo' that has no '/' separator.","commonSituations":"Local invocation outside GitHub Actions (where GITHUB_REPOSITORY is auto-set), a typo in the repo slug, or a workflow missing the env var.","solutions":["Pass the repo explicitly: `sheriff.mjs --repo owner/name`.","Export GITHUB_REPOSITORY=owner/name before running.","In GitHub Actions, ensure the job has access to the default GITHUB_REPOSITORY env var."],"exampleFix":"# before\nnode scripts/github/sheriff.mjs --apply\n\n# after\nnode scripts/github/sheriff.mjs --repo owner/name --apply","handlingStrategy":"validation","validationCode":"function resolveRepoSlug(options, env) {\n  const repo = options.repo || env.GITHUB_REPOSITORY;\n  return typeof repo === 'string' && repo.includes('/') ? repo : null;\n}","typeGuard":"function isRepoSlug(value) {\n  return typeof value === 'string' && /^[\\w.-]+\\/[\\w.-]+$/.test(value);\n}","tryCatchPattern":"const repo = resolveRepoSlug(options, process.env);\nif (!repo) {\n  console.error('Missing repository. Pass --repo owner/name or set GITHUB_REPOSITORY.');\n  process.exit(2);\n}","preventionTips":["Always pass --repo in local invocations.","In CI, ensure the job inherits GITHUB_REPOSITORY or sets it explicitly.","Validate the slug shape with isRepoSlug before running sheriff."],"tags":["github","cli","sheriff","validation","ci"],"backgroundTag":null,"analyzedSha":"d14711ae3d1a1dd62dee61a358d27f107c51ccd0","analyzedAt":"2026-08-13T00:52:25.771Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}