{"record":{"id":"54bf2285e3e2748a","repo":"can1357/oh-my-pi","slug":"no-prewalk-cannot-be-combined-with-prewalk-or","errorCode":null,"errorMessage":"--no-prewalk cannot be combined with --prewalk or --prewalk-into","messagePattern":"--no-prewalk cannot be combined with --prewalk or --prewalk-into","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/main.ts","lineNumber":1235,"sourceCode":"\t\t// deferring under an explicit CLI scope would let the saved default\n\t\t// escape it — keep pinning the first scoped model there.\n\t\tdeferredDefaultRole = !options.model && Boolean(remembered) && !((parsed.models?.length ?? 0) > 0);\n\t\tif (!options.model && !deferredDefaultRole) options.model = scopedModels[0].model;\n\t} else if ((parsed.models?.length ?? 0) > 0 && !restoringSession) {\n\t\t// A CLI `--models` scope that resolved to zero models at startup: its\n\t\t// selectors name only models supplied by extension providers (or discovery)\n\t\t// that register during createAgentSession, so nothing matched the\n\t\t// pre-session catalog and `getDiscoverableProviders()` did not yet list the\n\t\t// provider for resolveScopedModels' pre-refresh. Defer the choice to the\n\t\t// SDK's post-extension resolution — the same `modelPattern` path a deferred\n\t\t// `--model` uses — so the initial model is picked from the requested scope\n\t\t// instead of an unrelated fallback. The fire-and-forget rebuild then\n\t\t// activates the scoped list once discovery settles (issue #9220).\n\t\toptions.modelPattern = parsed.models;\n\t}\n\n\tif (parsed.noPrewalk && (parsed.prewalk || parsed.prewalkInto !== undefined)) {\n\t\tthrow new Error(\"--no-prewalk cannot be combined with --prewalk or --prewalk-into\");\n\t}\n\tconst explicitPrewalk = parsed.prewalk === true || parsed.prewalkInto !== undefined;\n\tconst prewalkEnabled = parsed.noPrewalk\n\t\t? false\n\t\t: explicitPrewalk\n\t\t\t? true\n\t\t\t: !restoringSession && activeSettings.get(\"prewalk.enabled\");\n\tif (prewalkEnabled) {\n\t\tconst rolePattern = expandRoleAlias(parsed.prewalkInto ?? DEFAULT_PREWALK_TARGET, activeSettings);\n\t\tconst resolved = resolveCliModel({ cliModel: rolePattern, modelRegistry, preferences: modelMatchPreferences });\n\t\tif (resolved.warning) {\n\t\t\tprocess.stderr.write(`${chalk.yellow(`Warning: ${resolved.warning}`)}\\n`);\n\t\t}\n\t\t// Prewalk is an optional optimization (off by default): switch to a fast\n\t\t// model at the first edit. If its hand-off target can't be resolved or has\n\t\t// no configured auth, warn and leave prewalk unarmed rather than aborting\n\t\t// startup and locking the user out of the app (issue #6064).\n\t\tif (resolved.error || !resolved.model) {","sourceCodeStart":1217,"sourceCodeEnd":1253,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/main.ts#L1217-L1253","documentation":"The CLI validates that model prewalk configuration is not self-contradictory. `--no-prewalk` explicitly disables prewalk discovery, while `--prewalk` / `--prewalk-into` explicitly enable or target it; combining them is ambiguous, so main.ts throws immediately during argument parsing. Fix the flags rather than catching — this runs before the app starts.","triggerScenarios":"Running `omp` with `--no-prewalk` together with `--prewalk` or `--prewalk-into <target>` on the same command line.","commonSituations":"Shell aliases or scripts that append `--no-prewalk` while the user manually adds a prewalk flag; env/CI wrappers layering flags on a base command that already disables prewalk.","solutions":["Remove `--no-prewalk` if you want prewalk enabled via `--prewalk`/`--prewalk-into`.","Remove `--prewalk`/`--prewalk-into` if you intended to disable prewalk entirely.","Review wrapper scripts/aliases so they don't inject conflicting prewalk flags."],"exampleFix":"// before\nomp --no-prewalk --prewalk-into \"gpt-5\"\n\n// after\nomp --prewalk-into \"gpt-5\"","handlingStrategy":"validation","validationCode":"const flags = process.argv;\nif (flags.includes(\"--no-prewalk\") && (flags.includes(\"--prewalk\") || flags.some(a => a.startsWith(\"--prewalk-into\")))) {\n  throw new Error(\"--no-prewalk cannot be combined with --prewalk or --prewalk-into\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep prewalk config in one place (script/alias), not spread across wrappers.","Validate flag combinations in CI scripts before launching."],"tags":["cli","argument-validation","prewalk"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}