affaan-m/ECC · error · Error

Missing GitHub repo. Pass --repo <owner/repo>.

Error message

Missing GitHub repo. Pass --repo <owner/repo>.

What it means

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).

Source

Thrown at scripts/work-items.js:272

    closed.push(
      store.upsertWorkItem({
        ...item,
        status: 'closed',
        updatedAt: new Date().toISOString(),
        metadata: {
          ...item.metadata,
          sourceClosedAt: new Date().toISOString()
        }
      })
    );
  }
  return closed;
}

function syncGithubWorkItems(store, options) {
  const repo = options.githubRepo;
  if (!repo) {
    throw new Error('Missing GitHub repo. Pass --repo <owner/repo>.');
  }

  const limit = normalizeLimit(options.limit);
  const prs = runGhJson(['pr', 'list', '--repo', repo, '--state', 'open', '--limit', String(limit), '--json', 'number,title,author,url,updatedAt,mergeStateStatus,isDraft,headRefName']);
  const issues = runGhJson(['issue', 'list', '--repo', repo, '--state', 'open', '--limit', String(limit), '--json', 'number,title,author,url,updatedAt,labels']);

  const syncedAt = new Date().toISOString();
  const activeIds = new Set();
  const items = [];
  for (const pr of prs) {
    const payload = buildGithubPrWorkItem(repo, pr, options);
    activeIds.add(payload.id);
    items.push(
      store.upsertWorkItem({
        ...payload,
        createdAt: undefined,
        updatedAt: syncedAt
      })

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Pass the repo explicitly: `node scripts/work-items.js sync-github --repo owner/name` (e.g. --repo affaan-m/ECC).
  2. If you prefer the long form, use --github-repo owner/name; it works regardless of command.
  3. Confirm the subcommand token is exactly 'sync-github' so --repo is remapped to githubRepo rather than repoRoot.
  4. If scripting, set options.githubRepo programmatically before calling syncGithubWorkItems(store, options).

Example fix

// before
node scripts/work-items.js sync-github

// after
node scripts/work-items.js sync-github --repo affaan-m/ECC
Defensive patterns

Strategy: validation

Validate before calling

function ensureGithubRepo(options) {
  const repo = options.githubRepo || options.repo; // caller may pass either
  if (!repo || !/^[\w.-]+\/[\w.-]+$/.test(repo)) {
    throw new Error('Pass --repo <owner/repo> for sync-github.');
  }
  options.githubRepo = repo;
  return options;
}
// call before syncGithubWorkItems(store, ensureGithubRepo(options))

Type guard

function isGithubRepoOption(options) {
  return Boolean(options && options.githubRepo && typeof options.githubRepo === 'string'
    && /^[\w.-]+\/[\w.-]+$/.test(options.githubRepo));
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/c30b3ad57f3345be. Report an issue: GitHub.