ReactiveX/rxjs · error · Error

--project-root requires a directory

Error message

--project-root requires a directory

What it means

Thrown by parseSkillArguments when --project-root is passed without a following value (e.g. it is the last token), so projectRoot would be undefined.

Source

Thrown at packages/migrate/src/skill-cli.ts:88

function parseSkillArguments(argv: readonly string[]): ParsedSkillCliOptions {
  const action = argv[0];
  if (action !== 'check' && action !== 'install' && action !== 'update' && action !== 'remove') {
    throw new Error(
      'Usage: rxjs-migrate-skill <check|install|update|remove> --harness <codex|claude|cursor> [--project-root <dir>] [--force]'
    );
  }
  let harness: SkillHarness | undefined;
  let projectRoot = process.cwd();
  let force = false;
  for (let index = 1; index < argv.length; index++) {
    const argument = argv[index];
    if (argument === '--harness') {
      const value = argv[++index];
      if (!value || !skillHarnesses.includes(value as SkillHarness)) throw new Error('--harness requires codex, claude, or cursor');
      harness = value as SkillHarness;
    } else if (argument === '--project-root') {
      const value = argv[++index];
      if (!value) throw new Error('--project-root requires a directory');
      projectRoot = value;
    } else if (argument === '--force') {
      force = true;
    } else {
      throw new Error(`Unknown option: ${String(argument)}`);
    }
  }
  if (!harness) throw new Error('--harness is required');
  return { action, harness, projectRoot, force };
}

function writeJson(stream: Pick<NodeJS.WriteStream, 'write'>, value: unknown): void {
  stream.write(`${JSON.stringify(value, null, 2)}\n`);
}

function messageFor(error: unknown): string {
  return error instanceof Error ? error.message : String(error);
}

View on GitHub (pinned to 54796b38a5)

Solutions

  1. Supply the directory: --project-root /path/to/project
  2. In scripts, guard that the variable is non-empty before passing the flag
  3. Omit the flag to default to the current working directory

Example fix

# before
rxjs-migrate-skill check --harness claude --project-root
# after
rxjs-migrate-skill check --harness claude --project-root ./my-project
Defensive patterns

Strategy: validation

Validate before calling

if (!process.env.PROJECT_ROOT) { delete argvEntry; } // only pass --project-root when the value exists

Type guard

const isNonEmpty = (s: string | undefined): s is string => !!s && s.length > 0;

Prevention

When it happens

Trigger: Ending the command with --project-root and no directory, or shell-quoting mistakes that swallow the value.

Common situations: Script templates where the root variable is empty: --project-root "$ROOT" with ROOT unset expands to nothing.

Related errors


AI-assisted analysis of ReactiveX/rxjs@54796b38a5 (2026-08-28). Data as JSON: /api/errors/d7b3a5e1b992edc3. Report an issue: GitHub.