{"record":{"id":"d1074fbb3f431ac3","repo":"rohitg00/agentmemory","slug":"ignoring-max-files-raw-expected-a-positive-i","errorCode":null,"errorMessage":"Ignoring --max-files ${raw}: expected a positive integer.","messagePattern":"Ignoring --max-files (.+?): expected a positive integer\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/cli.ts","lineNumber":3672,"sourceCode":"\nasync function runImportJsonl(): Promise<void> {\n  // Long-form flags that take a value. Their value tokens must be\n  // consumed alongside the flag so they don't leak into positional\n  // args (e.g. `--port 3112 import-jsonl` would otherwise turn\n  // 3112 into pathArg).\n  const VALUE_FLAGS = new Set([\"--port\", \"--tools\", \"--data-dir\"]);\n  let maxFiles: number | undefined;\n  const tail = args.slice(1);\n  const positional: string[] = [];\n  for (let i = 0; i < tail.length; i++) {\n    const a = tail[i]!;\n    if (a === \"--max-files\") {\n      const raw = tail[i + 1];\n      const parsed = raw !== undefined ? parseInt(raw, 10) : NaN;\n      if (Number.isInteger(parsed) && parsed > 0) {\n        maxFiles = parsed;\n      } else if (raw !== undefined) {\n        p.log.warn(`Ignoring --max-files ${raw}: expected a positive integer.`);\n      }\n      i++;\n      continue;\n    }\n    if (a.startsWith(\"--max-files=\")) {\n      const raw = a.slice(\"--max-files=\".length);\n      const parsed = parseInt(raw, 10);\n      if (Number.isInteger(parsed) && parsed > 0) {\n        maxFiles = parsed;\n      } else {\n        p.log.warn(`Ignoring --max-files=${raw}: expected a positive integer.`);\n      }\n      continue;\n    }\n    if (VALUE_FLAGS.has(a)) {\n      i++;\n      continue;\n    }","sourceCodeStart":3654,"sourceCodeEnd":3690,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/cli.ts#L3654-L3690","documentation":"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.","triggerScenarios":"`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.","commonSituations":"Typos, shell quoting mistakes, copying examples with placeholder text, forgetting the value entirely so the next flag is consumed.","solutions":["Pass a positive integer: --max-files 5000","Use the = form to bind the value explicitly: --max-files=5000","Check shell quoting so the value isn't swallowed by the next argument"],"exampleFix":"// before\n$ agentmemory import-jsonl --max-files 10k\nwarn: Ignoring --max-files 10k: expected a positive integer.\n// after\n$ agentmemory import-jsonl --max-files 10000","handlingStrategy":"validation","validationCode":"const n = Number(process.argv[process.argv.indexOf(\"--max-files\") + 1]);\nif (!Number.isInteger(n) || n <= 0) throw new Error(\"--max-files must be a positive integer\");","typeGuard":"function isPositiveInt(v: unknown): v is number { return Number.isInteger(v) && v > 0; }","tryCatchPattern":null,"preventionTips":["Always pass an explicit numeric value with --max-files","Use the --max-files=N form to avoid value/flag confusion","Shell-quote arguments in scripts"],"tags":["cli","argument-parsing","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}