rohitg00/agentmemory · warning

Ignoring --max-files ${raw}: expected a positive integer.

Error message

Ignoring --max-files ${raw}: expected a positive integer.

What it means

Warning when a --max-files <value> argument fails to parse as a positive integer (missing value, non-numeric, zero, negative, or float). The invalid value is ignored and the default cap is used.

Source

Thrown at src/cli.ts:3672

async function runImportJsonl(): Promise<void> {
  // Long-form flags that take a value. Their value tokens must be
  // consumed alongside the flag so they don't leak into positional
  // args (e.g. `--port 3112 import-jsonl` would otherwise turn
  // 3112 into pathArg).
  const VALUE_FLAGS = new Set(["--port", "--tools", "--data-dir"]);
  let maxFiles: number | undefined;
  const tail = args.slice(1);
  const positional: string[] = [];
  for (let i = 0; i < tail.length; i++) {
    const a = tail[i]!;
    if (a === "--max-files") {
      const raw = tail[i + 1];
      const parsed = raw !== undefined ? parseInt(raw, 10) : NaN;
      if (Number.isInteger(parsed) && parsed > 0) {
        maxFiles = parsed;
      } else if (raw !== undefined) {
        p.log.warn(`Ignoring --max-files ${raw}: expected a positive integer.`);
      }
      i++;
      continue;
    }
    if (a.startsWith("--max-files=")) {
      const raw = a.slice("--max-files=".length);
      const parsed = parseInt(raw, 10);
      if (Number.isInteger(parsed) && parsed > 0) {
        maxFiles = parsed;
      } else {
        p.log.warn(`Ignoring --max-files=${raw}: expected a positive integer.`);
      }
      continue;
    }
    if (VALUE_FLAGS.has(a)) {
      i++;
      continue;
    }

View on GitHub (pinned to e04ba88819)

Solutions

  1. Pass a positive integer: --max-files 5000
  2. Use the = form to bind the value explicitly: --max-files=5000
  3. Check shell quoting so the value isn't swallowed by the next argument

Example fix

// before
$ agentmemory import-jsonl --max-files 10k
warn: Ignoring --max-files 10k: expected a positive integer.
// after
$ agentmemory import-jsonl --max-files 10000
Defensive patterns

Strategy: validation

Validate before calling

const n = Number(process.argv[process.argv.indexOf("--max-files") + 1]);
if (!Number.isInteger(n) || n <= 0) throw new Error("--max-files must be a positive integer");

Type guard

function isPositiveInt(v: unknown): v is number { return Number.isInteger(v) && v > 0; }

Prevention

When it happens

Trigger: `agentmemory import-jsonl --max-files` followed by a value that parseInt cannot turn into an integer > 0, e.g. `--max-files abc`, `--max-files 0`, `--max-files -5`, `--max-files 2.5`, or trailing flag value.

Common situations: Typos, shell quoting mistakes, copying examples with placeholder text, forgetting the value entirely so the next flag is consumed.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of rohitg00/agentmemory@e04ba88819 (2026-08-30). Data as JSON: /api/errors/d1074fbb3f431ac3. Report an issue: GitHub.