can1357/oh-my-pi · error · CliUsageError
--agents must be a positive integer
Error message
--agents must be a positive integer
What it means
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.
Source
Thrown at packages/coding-agent/src/commands/cleanse.ts:50
char: "a",
description: "Run every discovered checker without the interactive picker",
default: false,
}),
};
static examples = [
"omp cleanse",
"omp cleanse --all",
'omp cleanse "ts errors"',
"omp cleanse -n 8",
"omp cleanse -m opus",
"omp cleanse -t",
"omp cleanse --agents 12 --model anthropic/claude-opus-4-6",
];
async run(): Promise<void> {
const { args, flags } = await this.parse(Cleanse);
if (flags.agents <= 0) throw new CliUsageError("--agents must be a positive integer");
const result = await runCleanseCommand({
maxAgents: flags.agents,
model: flags.model,
includeTests: flags.tests,
request: args.request,
all: flags.all,
});
await postmortem.quit(result.exitCode);
}
}
View on GitHub (pinned to 9690622007)
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
Example fix
// before omp cleanse --agents 0 -t // after omp cleanse --agents 4 -t
Defensive patterns
Strategy: validation
Validate before calling
const agents = Number(rawAgents);
if (!Number.isInteger(agents) || agents <= 0) {
throw new Error(`--agents must be a positive integer, got: ${rawAgents}`);
} Type guard
function isPositiveInt(n) { return typeof n === 'number' && Number.isInteger(n) && n > 0; } Try / catch
try {
await Cleanse.run(['--agents', String(agents)]);
} catch (err) {
if (err instanceof CliUsageError && err.message.includes('--agents')) {
console.error(`Bad --agents value: ${agents}. Use an integer >= 1.`);
process.exitCode = 1;
} else throw err;
} Prevention
- 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
When it happens
Trigger: 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'.
Common situations: 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'.
Related errors
- No snippet provided. Pass inline text, --file <path>, or pip
- --rounds must be a positive integer
- --agents must be a positive integer
- --repaint must be a positive integer
- invalid {} argument: {}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/c70d828ea0d066e6.
Report an issue: GitHub.