yamadashy/repomix · error · RepomixError

Invalid number for --include-logs-count: '${v}'. Must be a n

Error message

Invalid number for --include-logs-count: '${v}'. Must be a non-negative integer.

What it means

`--include-logs-count` controls how many recent git commits are included with `--include-logs`. The CLI enforces `/^\d+$/` (non-negative integer) in its parser, throwing this RepomixError for anything else.

Source

Thrown at src/cli/cliRun.ts:150

        ).argParser(parseHumanSizeToBytes),
      )
      .option('--include-empty-directories', 'Include folders with no files in directory structure')
      .option(
        '--include-full-directory-structure',
        'Show entire repository tree in the Directory Structure section, even when using --include patterns',
      )
      .option(
        '--no-git-sort-by-changes',
        "Don't sort files by git change frequency (default: most changed files first)",
      )
      .option('--include-diffs', 'Add git diff section showing working tree and staged changes')
      .option('--include-logs', 'Add git commit history with messages and changed files')
      .option(
        '--include-logs-count <count>',
        'Number of recent commits to include with --include-logs (default: 50)',
        (v: string) => {
          if (!/^\d+$/.test(v)) {
            throw new RepomixError(`Invalid number for --include-logs-count: '${v}'. Must be a non-negative integer.`);
          }
          return Number(v);
        },
      )
      // File Selection Options
      .optionsGroup('File Selection Options')
      .option(
        '--include <patterns>',
        'Include only files matching these glob patterns (comma-separated, e.g., "src/**/*.js,*.md")',
      )
      .option('-i, --ignore <patterns>', 'Additional patterns to exclude (comma-separated, e.g., "*.test.js,docs/**")')
      .option('--no-gitignore', "Don't use .gitignore rules for filtering files")
      .option('--no-dot-ignore', "Don't use .ignore rules for filtering files")
      .option('--no-default-patterns', "Don't apply built-in ignore patterns (node_modules, .git, build dirs, etc.)")
      // Remote Repository Options
      .optionsGroup('Remote Repository Options')
      .option('--remote <url>', 'Clone and pack a remote repository (GitHub URL or user/repo format)')
      .option('--remote-branch <name>', "Specific branch, tag, or commit to use (default: repository's default branch)")

View on GitHub (pinned to f465ad9093)

Solutions

  1. Pass a plain non-negative integer: `--include-logs-count 50`
  2. Omit the option entirely to use the default (50)
  3. Verify script variables expand to valid integers

Example fix

// before
repomix --include-logs --include-logs-count all
// after
repomix --include-logs --include-logs-count 100
Defensive patterns

Strategy: validation

Validate before calling

const i = process.argv.indexOf('--include-logs-count');
const v = i !== -1 ? process.argv[i + 1] : undefined;
if (v !== undefined && !/^\d+$/.test(v)) {
  throw new Error(`--include-logs-count needs a non-negative integer, got: ${v}`);
}

Type guard

const isNonNegativeInt = (v: unknown): v is number =>
  typeof v === 'number' && Number.isInteger(v) && v >= 0;

Try / catch

try {
  parseArgv(argv);
} catch (e) {
  if (e instanceof RepomixError && e.message.includes('--include-logs-count')) {
    console.error('Usage: --include-logs-count 50 (non-negative integer)');
  }
  process.exitCode = 1;
}

Prevention

When it happens

Trigger: Passing `--include-logs-count` with a negative, decimal, or non-numeric value (e.g. `-5`, `50.0`, `all`), or the option consuming the next flag when the value is omitted.

Common situations: Users trying semantic values like `--include-logs-count all`, typos in scripts, or missing the value so the next flag is parsed as the count.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/2de594777a1f466c. Report an issue: GitHub.