openai/codex-plugin-cc · error · Error

Choose either --resume/--resume-last or --fresh.

Error message

Choose either --resume/--resume-last or --fresh.

What it means

In handleTask, resumeLast is true if --resume or --resume-last is set, and fresh is true if --fresh is set. They are mutually exclusive because --resume continues an existing thread while --fresh forces starting a new one. The guard runs before job creation so no ambiguous state is recorded.

Source

Thrown at plugins/codex/scripts/codex-companion.mjs:780

async function handleTask(argv) {
  const { options, positionals } = parseCommandInput(argv, {
    valueOptions: ["model", "effort", "cwd", "prompt-file"],
    booleanOptions: ["json", "write", "resume-last", "resume", "fresh", "background"],
    aliasMap: {
      m: "model"
    }
  });

  const cwd = resolveCommandCwd(options);
  const workspaceRoot = resolveCommandWorkspace(options);
  const model = normalizeRequestedModel(options.model);
  const effort = normalizeReasoningEffort(options.effort);
  const prompt = readTaskPrompt(cwd, options, positionals);

  const resumeLast = Boolean(options["resume-last"] || options.resume);
  const fresh = Boolean(options.fresh);
  if (resumeLast && fresh) {
    throw new Error("Choose either --resume/--resume-last or --fresh.");
  }
  const write = Boolean(options.write);
  const taskMetadata = buildTaskRunMetadata({
    prompt,
    resumeLast
  });

  if (options.background) {
    ensureCodexAvailable(cwd);
    requireTaskRequest(prompt, resumeLast);

    const job = buildTaskJob(workspaceRoot, taskMetadata, write);
    const request = buildTaskRequest({
      cwd,
      model,
      effort,
      prompt,
      write,

View on GitHub (pinned to db52e28f4d)

Solutions

  1. Use --resume (or --resume-last) to continue the latest task thread.
  2. Use --fresh to start a new thread ignoring prior state.
  3. Omit both to use default behavior (which is fresh unless resume logic elsewhere applies).

Example fix

// before
codex-companion.mjs task --resume-last --fresh "prompt"
// after
codex-companion.mjs task --fresh "prompt"
Defensive patterns

Strategy: validation

Validate before calling

if (resumeLast && fresh) throw new Error('mutually exclusive');

Prevention

When it happens

Trigger: Running `task --resume --fresh` or `task --resume-last --fresh`, typically from an alias or automation that sets both defensively.

Common situations: A wrapper that always passes --fresh as a 'reset' but also forwards --resume from history; a user unsure which flag applies and passing both.

Related errors


AI-assisted analysis of openai/codex-plugin-cc@db52e28f4d (2026-08-13). Data as JSON: /api/errors/68b9f972e5842585. Report an issue: GitHub.