Yeachan-Heo/oh-my-codex · error · Error

Please choose either "launch" or "refine further".

Error message

Please choose either "launch" or "refine further".

What it means

In the interactive (non-structured) branch of promptAction(), the user's typed next-step input must be empty (default), 'launch', or one of 'refine further'/'refine'/'r' (case-insensitive). Anything else throws immediately without re-prompting.

Source

Thrown at src/cli/autoresearch-guided.ts:156

			? answer.value.trim().toLowerCase()
			: "";
		if (answerValue === "launch") return "launch";
		if (answerValue === "refine") return "refine";
		throw new Error('Structured question returned an invalid next-step answer.');
	}

	const answer = (
		await io.question(
			`\nNext step [launch/refine further] (default: ${launchReady ? "launch" : "refine further"})\n> `,
		)
	)
		.trim()
		.toLowerCase();
	if (!answer) return launchReady ? "launch" : "refine";
	if (answer === "launch") return "launch";
	if (answer === "refine further" || answer === "refine" || answer === "r")
		return "refine";
	throw new Error('Please choose either "launch" or "refine further".');
}

function createStructuredQuestionAsker(
	repoRoot: string,
): AutoresearchStructuredQuestionAsker {
	return (input) =>
		runDeepInterviewQuestion(
			{
				header: input.header,
				question: input.question,
				options: input.options,
				allow_other: input.allow_other,
				other_label: input.other_label ?? "Other",
				type: input.type,
				multi_select: input.multi_select ?? false,
				source: input.source ?? "deep-interview",
			},
			{ cwd: repoRoot },

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Type exactly 'launch' or 'refine' (or press Enter to accept the default shown in the prompt)
  2. When piping input non-interactively, echo one of the accepted tokens or an empty line
  3. If scripting, prefer the structured-question path with constrained answers

Example fix

# before
echo 'go' | omx autoresearch ...
# after
echo 'launch' | omx autoresearch ...
Defensive patterns

Strategy: validation

Validate before calling

const raw = (await io.question('Next step [launch/refine further]\n> ')).trim().toLowerCase();
const ok = raw === '' || raw === 'launch' || ['refine further','refine','r'].includes(raw);
if (!ok) { /* re-prompt instead of failing */ }

Type guard

const isNextStep = (s: string): s is 'launch'|'refine' => {
  const v = s.trim().toLowerCase();
  return v === 'launch' || v === 'refine' || v === 'refine further' || v === 'r';
};

Try / catch

try { return await promptAction(io); } catch (e) { if (e.message.includes('launch or refine')) { printAcceptedValues(); return await promptAction(io); } throw e; }

Prevention

When it happens

Trigger: A user typing 'go', 'yes', 'l', 'start', or any unrecognized text at the 'Next step [launch/refine further]' prompt.

Common situations: Users abbreviating beyond the accepted aliases (only 'r' is accepted for refine; 'l' is not accepted for launch), or piped stdin containing unexpected text.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/9d621b413e9af75b. Report an issue: GitHub.