santifer/career-ops · error · Error

repo must be named "career-ops-plugin

Error message

repo must be named "career-ops-plugin-<name>" (got "${repoName}")

What it means

After URL validation, parseRepoArg derives the plugin id from the repo name, which must match the naming convention career-ops-plugin-<name> (NAME_RE). This convention guarantees the extracted id is safe and namespaced; repos outside the convention are refused.

Solutions

  1. Rename the repo to career-ops-plugin-<name> or use a fork that follows the convention
  2. Verify the URL ends exactly at the repo name (no /tree/... suffix)
  3. Check the prefix spelling: it must start with career-ops-plugin-
  4. If the plugin is third-party and can't be renamed, ask the maintainer to adopt the naming convention

Example fix

// before
parseRepoArg('https://github.com/acme/ops-plugin-demo');
// after
parseRepoArg('https://github.com/acme/career-ops-plugin-demo'); // id = 'demo'
Defensive patterns

Strategy: validation

Validate before calling

const validName = (repo) => /^career-ops-plugin-[A-Za-z0-9_-]+$/.test(repo); if (!validName(url.split('/').pop().replace(/\.git$/, ''))) throw new Error('repo must be named career-ops-plugin-<name>');

Type guard

const isPluginRepoName = (n) => typeof n === 'string' && n.startsWith('career-ops-plugin-');

Try / catch

try { parseRepoArg(arg); } catch (e) { if (e.message.includes('career-ops-plugin-<name>')) { console.error('Rename the repo to career-ops-plugin-<name> or pick a convention-following fork'); } else throw e; }

Prevention

When it happens

Trigger: parseRepoArg called with a valid GitHub URL whose last path segment is not of the form career-ops-plugin-<name> — e.g. github.com/acme/career-ops (missing plugin-), github.com/acme/ops-plugin-demo (wrong prefix), or a trailing segment picked up from a longer URL.

Common situations: Forking/renaming the plugin repo to a custom name; pointing at a fork named differently; passing a URL with a trailing path segment (/tree/main) that changes the parsed repo name; typo in the prefix.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/29e1ae09d700a079. Report an issue: GitHub.

Appendix: source

Thrown at plugin-install.mjs:36

import { hashPluginTree } from './plugins/_lock.mjs';
import { auditPlugin } from './plugin-audit.mjs';
import { validateFlags } from './lib/cli-flags.mjs';
import { isMainModule } from './lib/is-main-module.mjs';

const GITHUB_URL_RE = /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?(?:\.git)?$/;
const NAME_RE = /^career-ops-plugin-([a-z0-9][a-z0-9-]*)$/;
const SHA_RE = /^[0-9a-f]{40}$/;
const MIN_FILES = ['manifest.json', 'index.mjs', 'README.md', 'LICENSE'];

/** Normalize `owner/repo` | full URL into a validated github URL + the plugin id. */
export function parseRepoArg(arg) {
  let url = arg;
  if (/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(arg)) url = `https://github.com/${arg}`;
  url = url.replace(/\.git$/, '');
  if (!GITHUB_URL_RE.test(url)) throw new Error(`refusing non-GitHub/unsafe repo URL: ${arg} (expected https://github.com/<owner>/<repo>)`);
  const repoName = url.split('/').pop() || '';
  const m = NAME_RE.exec(repoName);
  if (!m) throw new Error(`repo must be named "career-ops-plugin-<name>" (got "${repoName}")`);
  return { url, id: m[1] };
}

/** Clone the EXACT pinned SHA into a fresh temp dir. Returns the temp dir path. */
export function safeClone(url, sha) {
  if (!SHA_RE.test(sha || '')) throw new Error(`a 40-hex commit --sha is required (got ${JSON.stringify(sha)})`);
  const dir = mkdtempSync(path.join(tmpdir(), 'co-plugin-'));
  const git = (...args) => execFileSync('git', ['-c', 'protocol.ext.allow=never', '-c', 'protocol.file.allow=never', ...args], { stdio: ['ignore', 'ignore', 'pipe'], timeout: 120_000 });
  try {
    git('-C', dir, 'init', '-q');
    git('-C', dir, 'remote', 'add', 'origin', '--', url);
    git('-C', dir, 'fetch', '--depth', '1', '--no-tags', '-q', 'origin', sha);
    git('-C', dir, 'checkout', '-q', 'FETCH_HEAD');
    rmSync(path.join(dir, '.git'), { recursive: true, force: true }); // drop VCS metadata (and any hooks)
    return dir;
  } catch (err) {
    rmSync(dir, { recursive: true, force: true });
    throw new Error(`clone of ${url}@${sha.slice(0, 10)} failed — ${err.stderr ? String(err.stderr).slice(0, 200) : err.message}`);

View on GitHub (pinned to aac998c7ed)