{"record":{"id":"6bc8c696c836bf0f","repo":"Yeachan-Heo/oh-my-codex","slug":"guidance-invalid-reasoning-mode-mode-expec","errorCode":null,"errorMessage":"${guidance}Invalid reasoning mode \"${mode}\". Expected one of: ${REASONING_MODES.join(\", \")}.\n${REASONING_USAGE}","messagePattern":"(.+?)Invalid reasoning mode \"(.+?)\"\\. Expected one of: (.+?)\\.\n(.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":3836,"sourceCode":"      console.log(`Current ${REASONING_KEY}: ${current}`);\n      return;\n    }\n\n    console.log(`${REASONING_KEY} is not set in ${configPath}.`);\n    console.log(REASONING_USAGE);\n    return;\n  }\n\n  if (!REASONING_MODE_SET.has(mode)) {\n    const unsupportedMode = isUnsupportedRootReasoningEffort(mode)\n      ? normalizeUnsupportedRootReasoningEffort(mode)\n      : undefined;\n    const guidance = unsupportedMode === \"max\"\n      ? `Reasoning mode \"${mode}\" is not supported by \"omx reasoning\".\\nPer-agent \"max\" is configured with agentReasoning; direct -c model_reasoning_effort=... is passed to Codex and remains capability-dependent.\\n`\n      : unsupportedMode === \"ultra\"\n        ? `Reasoning mode \"${mode}\" is not supported by OMX root or per-agent reasoning and is not an alias for \"max\".\\nDirect -c model_reasoning_effort=... remains opaque Codex passthrough.\\n`\n        : \"\";\n    throw new Error(\n      `${guidance}Invalid reasoning mode \"${mode}\". Expected one of: ${REASONING_MODES.join(\", \")}.\\n${REASONING_USAGE}`,\n    );\n  }\n\n  const { mkdir, readFile, writeFile } = await import(\"fs/promises\");\n  await mkdir(dirname(configPath), { recursive: true });\n\n  const existing = existsSync(configPath)\n    ? await readFile(configPath, \"utf-8\")\n    : \"\";\n  const updated = upsertTopLevelTomlString(existing, REASONING_KEY, mode);\n  await writeFile(configPath, updated);\n  console.log(`Set ${REASONING_KEY}=\"${mode}\" in ${configPath}`);\n}\n\nexport async function launchWithAuthHotswap(args: string[]): Promise<void> {\n  const launchCwd = process.cwd();\n  const { omxArgs, suffix } = splitOmxArgsAtEndOfOptions(args);","sourceCodeStart":3818,"sourceCodeEnd":3854,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L3818-L3854","documentation":"The `omx reasoning` command rejects a reasoning mode that is not in REASONING_MODES, with tailored guidance for 'max' (configure via agentReasoning instead of the reasoning command) and 'ultra' (not an alias for max; only direct -c model_reasoning_effort passthrough exists).","triggerScenarios":"Running `omx reasoning <mode>` with a mode outside the allowed set — commonly `omx reasoning max` or `omx reasoning ultra`, or a typo like 'hight'.","commonSituations":"Users assuming CLI flags from other tools (e.g. -c model_reasoning_effort=high semantics) map to OMX modes; docs/blog examples referencing 'max'/'ultra' efforts; muscle memory from older OMX versions with different mode names.","solutions":["Use one of the modes listed in the error's 'Expected one of' list","For 'max', configure it per-agent with agentReasoning in your agent config rather than the reasoning command","For arbitrary efforts, pass Codex config directly: -c model_reasoning_effort=... (capability-dependent passthrough)","Check REASONING_USAGE in the error text for the canonical invocation examples"],"exampleFix":"# before\n$ omx reasoning max\n\n# after\n$ omx reasoning high   # or configure agentReasoning for max","handlingStrategy":"validation","validationCode":"const REASONING_MODES = [\"minimal\", \"low\", \"medium\", \"high\"]; // consult the error's list\nif (!REASONING_MODES.includes(mode)) throw new UsageError(`use one of ${REASONING_MODES.join(\", \")}`);","typeGuard":"function isReasoningMode(m: string): boolean { return /^[a-z]+$/.test(m) && !['\"max\"', '\"ultra\"'].includes(m); }","tryCatchPattern":"try { await setReasoning(mode); } catch (e) { if (/Invalid reasoning mode/.test(e.message)) { printUsage(); } }","preventionTips":["Read the 'Expected one of' list in the error itself","Use agentReasoning config for max effort; -c model_reasoning_effort for passthrough","Wrap user-facing mode inputs in an enum validator"],"tags":["cli","validation","reasoning","config"],"backgroundTag":"invalid-enum-value","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}