{"record":{"id":"6759027511f6caef","repo":"can1357/oh-my-pi","slug":"use-cache-pairs-instead-of-runs-with-cache","errorCode":null,"errorMessage":"Use --cache-pairs instead of --runs with --cache","messagePattern":"Use --cache-pairs instead of --runs with --cache","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/cli/bench-cli.ts","lineNumber":861,"sourceCode":"\nfunction assertCacheModeSupported(targets: BenchTarget[]): void {\n\tif (targets.some(({ model }) => model.api === \"openai-codex-responses\")) {\n\t\tthrow new Error(\n\t\t\t\"--cache is not supported for openai-codex-responses because Codex WebSocket chaining cannot produce independent prompt-cache pairs\",\n\t\t);\n\t}\n}\n\nexport async function runBenchCommand(command: BenchCommandArgs, deps: BenchDependencies = {}): Promise<BenchSummary> {\n\tconst cacheMode = command.flags.cache === true;\n\tconst cacheFlagsUsed =\n\t\tcommand.flags.cachePrefixFile !== undefined ||\n\t\tcommand.flags.cachePrefixBytes !== undefined ||\n\t\tcommand.flags.cachePairs !== undefined ||\n\t\tcommand.flags.cacheConcurrency !== undefined;\n\tif (!cacheMode && cacheFlagsUsed) throw new Error(\"Cache flags require --cache\");\n\tif (cacheMode && command.flags.runs !== undefined)\n\t\tthrow new Error(\"Use --cache-pairs instead of --runs with --cache\");\n\tif (cacheMode && command.flags.prompt !== undefined) throw new Error(\"--cache builds its own stable-prefix prompts\");\n\tif (cacheMode && command.flags.profile !== undefined) throw new Error(\"--profile cannot be combined with --cache\");\n\tif (cacheMode && (command.flags.par ?? 1) > 1) {\n\t\tthrow new Error(\"--par cannot parallelize cold/warm pairs; use --cache-concurrency instead\");\n\t}\n\tconst profileFlag = command.flags.profile;\n\tif (\n\t\tprofileFlag !== undefined &&\n\t\tprofileFlag !== \"mix\" &&\n\t\tprofileFlag !== \"chat\" &&\n\t\tprofileFlag !== \"prefill\" &&\n\t\tprofileFlag !== \"generation\"\n\t) {\n\t\tthrow new Error(`Unknown --profile \"${profileFlag}\" (expected mix, chat, prefill, or generation)`);\n\t}\n\tconst profile: BenchProfile = profileFlag ?? \"mix\";\n\tif (!cacheMode && command.flags.prompt !== undefined && profile !== \"chat\" && profile !== \"generation\") {\n\t\tthrow new Error(\"--prompt requires --profile chat or generation\");","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/cli/bench-cli.ts#L843-L879","documentation":"The bench CLI supports two mutually exclusive workload modes: --runs (repeat the same prompt) and --cache (cold/warm stable-prefix pairs). Passing --runs together with --cache is contradictory because cache mode ignores run counts and instead uses --cache-pairs. The CLI validates flag combinations up front and throws this error instead of silently ignoring --runs.","triggerScenarios":"Running `omp bench --cache --runs 5 ...` or any command where --cache is set (directly or via cache sub-flags) and command.flags.runs is also defined.","commonSituations":"Reusing an old non-cache bench command and adding --cache to experiment with prompt-caching benchmarks; scripted bench matrices that append --runs unconditionally; copying docs from the runs-based mode while switching to cache mode.","solutions":["Remove --runs from the command when using --cache","Use --cache-pairs N to control how many cold/warm pairs are measured in cache mode","Split into two separate bench invocations if you need both runs-based and cache-based measurements"],"exampleFix":"// before\nomp bench sonnet --cache --runs 5\n// after\nomp bench sonnet --cache --cache-pairs 5","handlingStrategy":"validation","validationCode":"if (args.includes(\"--cache\") && (args.includes(\"--runs\") || args.runs !== undefined)) throw new Error(\"--runs is incompatible with --cache; use --cache-pairs\");","typeGuard":null,"tryCatchPattern":"try {\n  await runBench(argv);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"instead of --runs\")) {\n    console.error(\"Remove --runs when using --cache; use --cache-pairs.\");\n    process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Keep --cache and --runs in separate command templates or script branches","Validate flag combinations in wrapper scripts before spawning omp","Prefer --cache-pairs as the only count knob in cache mode"],"tags":["cli","flag-validation","mutually-exclusive-options"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}