can1357/oh-my-pi · error · CliUsageError

--repaint must be a positive integer

Error message

--repaint must be a positive integer

What it means

The --repaint flag on omp render takes a positive integer count of repaint passes. The check is conditional (only when the flag is provided) and rejects zero or negative values with a CliUsageError before rendering begins.

Source

Thrown at packages/coding-agent/src/commands/render.ts:37

		timing: Flags.boolean({ char: "t", description: "Print phase timings and emitted byte counts to stderr" }),
		repaint: Flags.integer({
			description: "Benchmark N extra full clear-scrollback repaints (the /tree navigation frame)",
		}),
		plain: Flags.boolean({ description: "Strip ANSI styling from the output", default: false }),
		quiet: Flags.boolean({ char: "q", description: "Suppress transcript output (benchmark runs)", default: false }),
	};

	static examples = [
		"omp render",
		"omp render 01a0285c --plain",
		"omp render ~/.omp/agent/sessions/--work-pi--/big.jsonl -q -t --repaint 5",
		"omp render -w 200 > thread.ansi",
	];

	async run(): Promise<void> {
		const { args, flags } = await this.parse(Render);
		if (flags.repaint !== undefined && flags.repaint <= 0) {
			throw new CliUsageError("--repaint must be a positive integer");
		}
		const exitCode = await runRenderCommand({
			session: args.session,
			width: flags.width,
			height: flags.height,
			timing: flags.timing,
			repaint: flags.repaint,
			plain: flags.plain,
			quiet: flags.quiet,
		});
		await postmortem.quit(exitCode);
	}
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass a positive integer, e.g. --repaint 2
  2. Omit --repaint entirely if you do not need extra repaint passes
  3. Clamp computed values: Math.max(1, n)

Example fix

// before
omp render thread.json --repaint 0
// after
omp render thread.json   # omit flag, or --repaint 1
Defensive patterns

Strategy: validation

Validate before calling

if (rawRepaint !== undefined) {
  const n = Number(rawRepaint);
  if (!Number.isInteger(n) || n <= 0) throw new Error(`--repaint must be a positive integer, got: ${rawRepaint}`);
}

Type guard

function isValidRepaint(v) { return v === undefined || (Number.isInteger(v) && v > 0); }

Try / catch

try {
  await Render.run(['--repaint', String(repaint)]);
} catch (err) {
  if (err instanceof CliUsageError && err.message.includes('--repaint')) {
    console.error('Omit --repaint or pass an integer >= 1.');
    process.exitCode = 1;
  } else throw err;
}

Prevention

When it happens

Trigger: 'omp render session.json --repaint 0' or '--repaint -1'; --repaint read from a config/variable that is 0.

Common situations: Trying to 'disable' repaint by passing 0 (instead of omitting the flag); computed values defaulting to 0 in render pipelines.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/226425b8e18a2cf7. Report an issue: GitHub.