{"record":{"id":"68b9f972e5842585","repo":"openai/codex-plugin-cc","slug":"choose-either-resume-resume-last-or-fresh","errorCode":null,"errorMessage":"Choose either --resume/--resume-last or --fresh.","messagePattern":"Choose either --resume/--resume-last or --fresh\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"plugins/codex/scripts/codex-companion.mjs","lineNumber":780,"sourceCode":"async function handleTask(argv) {\n  const { options, positionals } = parseCommandInput(argv, {\n    valueOptions: [\"model\", \"effort\", \"cwd\", \"prompt-file\"],\n    booleanOptions: [\"json\", \"write\", \"resume-last\", \"resume\", \"fresh\", \"background\"],\n    aliasMap: {\n      m: \"model\"\n    }\n  });\n\n  const cwd = resolveCommandCwd(options);\n  const workspaceRoot = resolveCommandWorkspace(options);\n  const model = normalizeRequestedModel(options.model);\n  const effort = normalizeReasoningEffort(options.effort);\n  const prompt = readTaskPrompt(cwd, options, positionals);\n\n  const resumeLast = Boolean(options[\"resume-last\"] || options.resume);\n  const fresh = Boolean(options.fresh);\n  if (resumeLast && fresh) {\n    throw new Error(\"Choose either --resume/--resume-last or --fresh.\");\n  }\n  const write = Boolean(options.write);\n  const taskMetadata = buildTaskRunMetadata({\n    prompt,\n    resumeLast\n  });\n\n  if (options.background) {\n    ensureCodexAvailable(cwd);\n    requireTaskRequest(prompt, resumeLast);\n\n    const job = buildTaskJob(workspaceRoot, taskMetadata, write);\n    const request = buildTaskRequest({\n      cwd,\n      model,\n      effort,\n      prompt,\n      write,","sourceCodeStart":762,"sourceCodeEnd":798,"githubUrl":"https://github.com/openai/codex-plugin-cc/blob/db52e28f4d9ded852ab3942cea316258ae4ef346/plugins/codex/scripts/codex-companion.mjs#L762-L798","documentation":"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.","triggerScenarios":"Running `task --resume --fresh` or `task --resume-last --fresh`, typically from an alias or automation that sets both defensively.","commonSituations":"A wrapper that always passes --fresh as a 'reset' but also forwards --resume from history; a user unsure which flag applies and passing both.","solutions":["Use --resume (or --resume-last) to continue the latest task thread.","Use --fresh to start a new thread ignoring prior state.","Omit both to use default behavior (which is fresh unless resume logic elsewhere applies)."],"exampleFix":"// before\ncodex-companion.mjs task --resume-last --fresh \"prompt\"\n// after\ncodex-companion.mjs task --fresh \"prompt\"","handlingStrategy":"validation","validationCode":"if (resumeLast && fresh) throw new Error('mutually exclusive');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a single mode enum (resume|fresh|default) in wrappers.","Never concat both flags from history."],"tags":["cli","validation","conflicting-flags","task"],"backgroundTag":null,"analyzedSha":"db52e28f4d9ded852ab3942cea316258ae4ef346","analyzedAt":"2026-08-13T05:13:20.855Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}