{"record":{"id":"0f981a3d5fa907d4","repo":"can1357/oh-my-pi","slug":"rounds-must-be-a-positive-integer","errorCode":null,"errorMessage":"--rounds must be a positive integer","messagePattern":"--rounds must be a positive integer","errorType":"validation","errorClass":"CliUsageError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/commands/compress.ts","lineNumber":32,"sourceCode":"\t\tinPlace: Flags.boolean({ char: \"i\", description: \"Overwrite each source file with its approved text\" }),\n\t\trounds: Flags.integer({ char: \"r\", description: \"Maximum drafts per file before giving up\", default: 3 }),\n\t\tagents: Flags.integer({ char: \"n\", description: \"Files compressed concurrently\", default: 4 }),\n\t\tmodel: Flags.string({ char: \"m\", description: \"Model selector\" }),\n\t};\n\n\tstatic examples = [\n\t\t\"omp compress prompts/tools/read.md\",\n\t\t\"omp compress notes.md -o notes.compressed.md\",\n\t\t\"omp compress 'src/prompts/**/*.md' -i\",\n\t\t\"omp compress a.md b.md c.md -i -n 8\",\n\t\t\"omp compress spec.md -r 5 -m opus\",\n\t];\n\n\tasync run(): Promise<void> {\n\t\tconst { args, flags } = await this.parse(Compress);\n\t\tconst files = args.files ?? [];\n\t\tif (files.length === 0) throw new CliUsageError(\"compress requires at least one file or glob pattern\");\n\t\tif (flags.rounds <= 0) throw new CliUsageError(\"--rounds must be a positive integer\");\n\t\tif (flags.agents <= 0) throw new CliUsageError(\"--agents must be a positive integer\");\n\t\tif (flags.inPlace && flags.out) throw new CliUsageError(\"--in-place and --out are mutually exclusive\");\n\t\tconst result = await runCompressCommand({\n\t\t\tfiles,\n\t\t\tmodel: flags.model,\n\t\t\tmaxRounds: flags.rounds,\n\t\t\tconcurrency: flags.agents,\n\t\t\toutput: flags.out,\n\t\t\tinPlace: flags.inPlace,\n\t\t});\n\t\tawait postmortem.quit(result.exitCode);\n\t}\n}\n","sourceCodeStart":14,"sourceCodeEnd":46,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/commands/compress.ts#L14-L46","documentation":"The --rounds flag on omp compress controls how many compression iterations run. Zero or negative values are meaningless as an iteration count, so the command validates it and throws a CliUsageError before starting.","triggerScenarios":"Running 'omp compress spec.md --rounds 0' or '--rounds -2'; passing --rounds from a variable/config that defaults to 0.","commonSituations":"Automation computing rounds = 0 to mean 'skip rounds' (unsupported); copy-paste from docs with a placeholder; misreading the default behavior and trying to disable rounds via 0.","solutions":["Use a positive integer, e.g. --rounds 5","Omit --rounds to use the default number of rounds","If the intent was 'do nothing', do not invoke compress at all"],"exampleFix":"// before\nomp compress spec.md --rounds 0\n// after\nomp compress spec.md --rounds 5","handlingStrategy":"validation","validationCode":"const rounds = Number(rawRounds);\nif (!Number.isInteger(rounds) || rounds <= 0) {\n  throw new Error(`--rounds must be a positive integer, got: ${rawRounds}`);\n}","typeGuard":"function isPositiveInt(n) { return typeof n === 'number' && Number.isInteger(n) && n > 0; }","tryCatchPattern":"try {\n  await Compress.run(['--rounds', String(rounds)]);\n} catch (err) {\n  if (err instanceof CliUsageError && err.message.includes('--rounds')) {\n    console.error(`Invalid --rounds: ${rounds}. Omit the flag or use >= 1.`);\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Omit --rounds to use the default rather than passing 0","Clamp computed values with Math.max(1, n)","Validate flags in scripts before spawning the CLI"],"tags":["cli","usage","validation"],"backgroundTag":"invalid-cli-flag-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}