{"record":{"id":"c70d828ea0d066e6","repo":"can1357/oh-my-pi","slug":"agents-must-be-a-positive-integer-c70d82","errorCode":null,"errorMessage":"--agents must be a positive integer","messagePattern":"--agents must be a positive integer","errorType":"validation","errorClass":"CliUsageError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/commands/cleanse.ts","lineNumber":50,"sourceCode":"\t\t\tchar: \"a\",\n\t\t\tdescription: \"Run every discovered checker without the interactive picker\",\n\t\t\tdefault: false,\n\t\t}),\n\t};\n\n\tstatic examples = [\n\t\t\"omp cleanse\",\n\t\t\"omp cleanse --all\",\n\t\t'omp cleanse \"ts errors\"',\n\t\t\"omp cleanse -n 8\",\n\t\t\"omp cleanse -m opus\",\n\t\t\"omp cleanse -t\",\n\t\t\"omp cleanse --agents 12 --model anthropic/claude-opus-4-6\",\n\t];\n\n\tasync run(): Promise<void> {\n\t\tconst { args, flags } = await this.parse(Cleanse);\n\t\tif (flags.agents <= 0) throw new CliUsageError(\"--agents must be a positive integer\");\n\t\tconst result = await runCleanseCommand({\n\t\t\tmaxAgents: flags.agents,\n\t\t\tmodel: flags.model,\n\t\t\tincludeTests: flags.tests,\n\t\t\trequest: args.request,\n\t\t\tall: flags.all,\n\t\t});\n\t\tawait postmortem.quit(result.exitCode);\n\t}\n}\n","sourceCodeStart":32,"sourceCodeEnd":61,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/commands/cleanse.ts#L32-L61","documentation":"The omp cleanse command parallelizes its work across N agents, controlled by the --agents flag. A value of zero, negative, or non-numeric-parsed-zero cannot be used as concurrency, so the command rejects it up front with a CliUsageError before doing any work.","triggerScenarios":"Running 'omp cleanse --agents 0 ...' or 'omp cleanse --agents -3 ...'; also a shell variable expansion that resolves to an empty/zero value, e.g. --agents $AGENTS where AGENTS is unset or '0'.","commonSituations":"Scripting the command with a computed concurrency value that defaults to 0; typos like --agents=-1; forgetting the flag has no default meaning of 'unlimited'.","solutions":["Pass a positive integer, e.g. --agents 4","If unset is desired, omit --agents entirely to use the command default","Fix the shell/CI variable feeding the flag so it is >= 1"],"exampleFix":"// before\nomp cleanse --agents 0 -t\n// after\nomp cleanse --agents 4 -t","handlingStrategy":"validation","validationCode":"const agents = Number(rawAgents);\nif (!Number.isInteger(agents) || agents <= 0) {\n  throw new Error(`--agents must be a positive integer, got: ${rawAgents}`);\n}","typeGuard":"function isPositiveInt(n) { return typeof n === 'number' && Number.isInteger(n) && n > 0; }","tryCatchPattern":"try {\n  await Cleanse.run(['--agents', String(agents)]);\n} catch (err) {\n  if (err instanceof CliUsageError && err.message.includes('--agents')) {\n    console.error(`Bad --agents value: ${agents}. Use an integer >= 1.`);\n    process.exitCode = 1;\n  } else throw err;\n}","preventionTips":["Default computed agent counts to a sane minimum: Math.max(1, n)","Never pass 0 to mean 'unlimited' — omit the flag instead","Assert flag values in CI wrappers before invoking 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"}