{"record":{"id":"c30b3ad57f3345be","repo":"affaan-m/ECC","slug":"missing-github-repo-pass-repo-owner-repo","errorCode":null,"errorMessage":"Missing GitHub repo. Pass --repo <owner/repo>.","messagePattern":"Missing GitHub repo\\. Pass --repo <owner/repo>\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/work-items.js","lineNumber":272,"sourceCode":"    closed.push(\n      store.upsertWorkItem({\n        ...item,\n        status: 'closed',\n        updatedAt: new Date().toISOString(),\n        metadata: {\n          ...item.metadata,\n          sourceClosedAt: new Date().toISOString()\n        }\n      })\n    );\n  }\n  return closed;\n}\n\nfunction syncGithubWorkItems(store, options) {\n  const repo = options.githubRepo;\n  if (!repo) {\n    throw new Error('Missing GitHub repo. Pass --repo <owner/repo>.');\n  }\n\n  const limit = normalizeLimit(options.limit);\n  const prs = runGhJson(['pr', 'list', '--repo', repo, '--state', 'open', '--limit', String(limit), '--json', 'number,title,author,url,updatedAt,mergeStateStatus,isDraft,headRefName']);\n  const issues = runGhJson(['issue', 'list', '--repo', repo, '--state', 'open', '--limit', String(limit), '--json', 'number,title,author,url,updatedAt,labels']);\n\n  const syncedAt = new Date().toISOString();\n  const activeIds = new Set();\n  const items = [];\n  for (const pr of prs) {\n    const payload = buildGithubPrWorkItem(repo, pr, options);\n    activeIds.add(payload.id);\n    items.push(\n      store.upsertWorkItem({\n        ...payload,\n        createdAt: undefined,\n        updatedAt: syncedAt\n      })","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/work-items.js#L254-L290","documentation":"Thrown by syncGithubWorkItems() when options.githubRepo is falsy. The sync-github subcommand drives gh pr list / gh issue list against a single target repository, so it refuses to run without one. The repo is read from options.githubRepo, which is populated by --github-repo, or by --repo only when the command is 'sync-github' (see assignOption at line 72).","triggerScenarios":"Running `node scripts/work-items.js sync-github` with neither --repo <owner/repo> nor --github-repo <owner/repo>. Also triggered when the flag is misspelled, when the value is missing and the next token starts with '--' (parseArgs rejects that separately), or when --repo is passed but the command word was misread so it was routed to repoRoot instead of githubRepo.","commonSituations":"Forgetting the repo flag on a CI invocation; copy-pasting a sync-github call from a docs example that omitted the repo; assuming --repo is the repo-root alias in this subcommand when it is actually remapped to githubRepo; passing the repo as a positional argument (it lands in positionals and is ignored).","solutions":["Pass the repo explicitly: `node scripts/work-items.js sync-github --repo owner/name` (e.g. --repo affaan-m/ECC).","If you prefer the long form, use --github-repo owner/name; it works regardless of command.","Confirm the subcommand token is exactly 'sync-github' so --repo is remapped to githubRepo rather than repoRoot.","If scripting, set options.githubRepo programmatically before calling syncGithubWorkItems(store, options)."],"exampleFix":"// before\nnode scripts/work-items.js sync-github\n\n// after\nnode scripts/work-items.js sync-github --repo affaan-m/ECC","handlingStrategy":"validation","validationCode":"function ensureGithubRepo(options) {\n  const repo = options.githubRepo || options.repo; // caller may pass either\n  if (!repo || !/^[\\w.-]+\\/[\\w.-]+$/.test(repo)) {\n    throw new Error('Pass --repo <owner/repo> for sync-github.');\n  }\n  options.githubRepo = repo;\n  return options;\n}\n// call before syncGithubWorkItems(store, ensureGithubRepo(options))","typeGuard":"function isGithubRepoOption(options) {\n  return Boolean(options && options.githubRepo && typeof options.githubRepo === 'string'\n    && /^[\\w.-]+\\/[\\w.-]+$/.test(options.githubRepo));\n}","tryCatchPattern":null,"preventionTips":["Always pass --repo on sync-github invocations; treat it as required, not optional.","In scripts, assert options.githubRepo is set before calling syncGithubWorkItems.","Remember --repo only maps to githubRepo for the sync-github command; elsewhere it is repo-root."],"tags":["cli","validation","github","missing-argument","sync"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}