can1357/oh-my-pi · error

--prefill-bytes requires prefill challenges (--profile mix o

Error message

--prefill-bytes requires prefill challenges (--profile mix or prefill)

What it means

--prefill-bytes only applies to benchmarks whose workload exercises prompt prefill caching — the mix or prefill profiles. It is also meaningless in --cache mode, which sizes prefixes itself. The CLI throws when prefillBytes is set under cache mode or a chat/generation profile.

Source

Thrown at packages/coding-agent/src/cli/bench-cli.ts:882

	if (cacheMode && (command.flags.par ?? 1) > 1) {
		throw new Error("--par cannot parallelize cold/warm pairs; use --cache-concurrency instead");
	}
	const profileFlag = command.flags.profile;
	if (
		profileFlag !== undefined &&
		profileFlag !== "mix" &&
		profileFlag !== "chat" &&
		profileFlag !== "prefill" &&
		profileFlag !== "generation"
	) {
		throw new Error(`Unknown --profile "${profileFlag}" (expected mix, chat, prefill, or generation)`);
	}
	const profile: BenchProfile = profileFlag ?? "mix";
	if (!cacheMode && command.flags.prompt !== undefined && profile !== "chat" && profile !== "generation") {
		throw new Error("--prompt requires --profile chat or generation");
	}
	if (command.flags.prefillBytes !== undefined && (cacheMode || (profile !== "mix" && profile !== "prefill"))) {
		throw new Error("--prefill-bytes requires prefill challenges (--profile mix or prefill)");
	}

	const cachePairs = cacheMode
		? normalizePositiveInteger("cache-pairs", command.flags.cachePairs, DEFAULT_CACHE_PAIRS)
		: undefined;
	const cacheConcurrency = cacheMode
		? normalizePositiveInteger("cache-concurrency", command.flags.cacheConcurrency, DEFAULT_CACHE_CONCURRENCY)
		: undefined;
	const runs = cacheMode
		? cachePairs! * 2
		: normalizePositiveInteger("runs", command.flags.runs, PROFILE_DEFAULT_RUNS[profile]);
	const maxTokensOverride =
		command.flags.maxTokens !== undefined
			? normalizePositiveInteger("max-tokens", command.flags.maxTokens, 1)
			: undefined;
	const cacheMaxTokens = cacheMode ? (maxTokensOverride ?? DEFAULT_CACHE_MAX_TOKENS) : undefined;
	const par =
		command.flags.par !== undefined ? normalizePositiveInteger("par", command.flags.par, DEFAULT_PAR) : DEFAULT_PAR;

View on GitHub (pinned to 9690622007)

Solutions

  1. Use --profile mix or --profile prefill when passing --prefill-bytes (without --cache)
  2. Remove --prefill-bytes if benchmarking chat or generation workloads
  3. In cache mode, use --cache-prefix-bytes / --cache-prefix-file instead of --prefill-bytes

Example fix

// before
omp bench sonnet --prefill-bytes 20000 --profile chat
// after
omp bench sonnet --prefill-bytes 20000 --profile prefill
Defensive patterns

Strategy: validation

Validate before calling

if (args.prefillBytes !== undefined && (useCacheMode || !(args.profile === "mix" || args.profile === "prefill")))
  throw new Error("--prefill-bytes requires --profile mix or prefill and no --cache");

Try / catch

try {
  await runBench(argv);
} catch (err) {
  if (err instanceof Error && err.message.includes("--prefill-bytes requires")) {
    console.error("Use --profile mix or prefill for --prefill-bytes; in cache mode use --cache-prefix-*.");
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Running `omp bench sonnet --prefill-bytes 20000` (default profile is mix — wait, mix is allowed, so the trigger is: --prefill-bytes with --profile chat/generation, or with --cache).

Common situations: Leftover --prefill-bytes flag in scripts switched to chat/generation profiles; combining cache benchmarks with prefill sizing flags; forgetting that the default mix profile is one of the few that accepts it.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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