jackwener/OpenCLI · error · ArgumentError
--repeat conflicts with the prompt (${structuredRepeat} vs $
Error message
--repeat conflicts with the prompt (${structuredRepeat} vs ${rawRepeat}) What it means
When both the prompt text (--r/--repeat flag) and the structured args.repeat option are present, resolveGenerationPlan requires them to agree. This error is thrown if the two values differ, e.g. prompt '--r 2' with args.repeat 4, to avoid ambiguity about how many jobs to run.
Source
Thrown at clis/midjourney/capabilities.js:242
throw new ArgumentError(`--quality is not supported by ${selectedModel}`);
}
if (quality) {
const normalizedQuality = Number(quality);
if (![0.25, 0.5, 1].includes(normalizedQuality)) {
throw new ArgumentError('--quality must be 0.25, 0.5, or 1 for supported legacy models');
}
}
const rawRepeat = promptParamValue(prompt, ['r', 'repeat']);
const structuredRepeat = args.repeat == null || args.repeat === '' ? null : Number(args.repeat);
if (structuredRepeat != null && (!Number.isInteger(structuredRepeat) || structuredRepeat < 1)) {
throw new ArgumentError('--repeat must be a positive integer');
}
if (rawRepeat != null && (!/^\d+$/.test(rawRepeat) || Number(rawRepeat) < 1)) {
throw new ArgumentError('--repeat in the prompt must be a positive integer');
}
if (structuredRepeat != null && rawRepeat != null && structuredRepeat !== Number(rawRepeat)) {
throw new ArgumentError(`--repeat conflicts with the prompt (${structuredRepeat} vs ${rawRepeat})`);
}
const repeat = structuredRepeat ?? (rawRepeat == null ? 1 : Number(rawRepeat));
if (repeat > capabilities.repeatLimit) {
throw new ArgumentError(`${capabilities.plan || 'current'} plan allows at most ${capabilities.repeatLimit} repeat/permutation jobs`);
}
let perJobMinutes = hasOmniReference || promptHasFlag(prompt, ['oref'])
? GPU_COST_MINUTES.omni
: resolution === 'hd'
? GPU_COST_MINUTES.imageHd
: GPU_COST_MINUTES.imageSd;
if (promptHasFlag(prompt, ['draft'])) perJobMinutes /= 2;
// The current web service charged a full SD batch for a live V6 --q 0.5
// job. Keep the cost guard conservative instead of applying historical
// quality discounts that are no longer reflected in account credits.
if (speed === 'turbo') perJobMinutes *= 2;
// Relax jobs do not consume the subscription's Fast GPU minute balance.
// Keep the guard and reported estimate aligned with the quota it protects.View on GitHub (pinned to 49907e53dc)
Solutions
- Make both values identical, or delete one: keep either the prompt flag or args.repeat, not both.
- Strip --r/--repeat (and other flags) from the prompt string and rely solely on args.repeat.
- If the prompt is built dynamically, remove its repeat flag programmatically before merging with structured options.
- If conflict is intentional, resolve it in your own code first by choosing one value.
Example fix
// before
await midjourney.generate({ prompt: 'a cat --r 2', repeat: 4 });
// after
await midjourney.generate({ prompt: 'a cat', repeat: 4 }); Defensive patterns
Strategy: validation
Validate before calling
function repeatsAgree(prompt, argsRepeat) {
const m = /(?:^|\s)--(?:r|repeat)(?:[= ]([^\s]+))?/.exec(prompt);
const raw = m ? m[1] : null;
if (argsRepeat == null || raw == null) return true;
return Number(argsRepeat) === Number(raw);
}
if (!repeatsAgree(prompt, args.repeat)) throw new Error('--repeat in args conflicts with prompt'); Type guard
function hasNoPromptRepeatFlag(prompt) {
return !/(?:^|\s)--(?:r|repeat)(?:[= ]|$)/.test(prompt);
} Try / catch
try {
return await plan(args);
} catch (err) {
if (err instanceof ArgumentError && err.message.startsWith('--repeat conflicts with the prompt')) {
// keep only one source of truth
const structured = args.repeat != null;
const cleanPrompt = structured ? prompt.replace(/\s*--(?:r|repeat)(?:[= ]\S+)?/, '') : prompt;
return plan({ ...args, prompt: cleanPrompt });
}
throw err;
} Prevention
- Pick one source of truth for repeat: structured args only; strip flags from prompts.
- When templates inject flags into prompts, diff them against structured options before sending.
- Centralize prompt-building so repeat is never appended in two places.
- Log the final prompt and args during development to spot duplicated flags.
When it happens
Trigger: Calling generate/plan with a prompt containing '--r 2' while also passing { repeat: 4 } (or any numeric args.repeat not equal to Number(promptFlag)). Both must be present and unequal.
Common situations: A wrapper/template injects --repeat into the prompt while the caller also sets args.repeat; an old hardcoded prompt string kept after switching to the structured option; copy-pasted prompts that still carry flags.
Related errors
- --unread and --seq are mutually exclusive
- archive search sort must be one of ${SORT_OPTIONS.join(', ')
- archive search mediatype must be one of ${MEDIATYPES.join(',
- archive search limit must be a positive integer
- archive search limit must be <= 100
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e88d13be705aece6.
Report an issue: GitHub.