{"record":{"id":"2558aa707fdca629","repo":"jackwener/OpenCLI","slug":"capabilities-plan-current-plan-allows-at-m","errorCode":null,"errorMessage":"${capabilities.plan || 'current'} plan allows at most ${capabilities.repeatLimit} repeat/permutation jobs","messagePattern":"(.+?) plan allows at most (.+?) repeat/permutation jobs","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/midjourney/capabilities.js","lineNumber":246,"sourceCode":"    if (![0.25, 0.5, 1].includes(normalizedQuality)) {\n      throw new ArgumentError('--quality must be 0.25, 0.5, or 1 for supported legacy models');\n    }\n  }\n\n  const rawRepeat = promptParamValue(prompt, ['r', 'repeat']);\n  const structuredRepeat = args.repeat == null || args.repeat === '' ? null : Number(args.repeat);\n  if (structuredRepeat != null && (!Number.isInteger(structuredRepeat) || structuredRepeat < 1)) {\n    throw new ArgumentError('--repeat must be a positive integer');\n  }\n  if (rawRepeat != null && (!/^\\d+$/.test(rawRepeat) || Number(rawRepeat) < 1)) {\n    throw new ArgumentError('--repeat in the prompt must be a positive integer');\n  }\n  if (structuredRepeat != null && rawRepeat != null && structuredRepeat !== Number(rawRepeat)) {\n    throw new ArgumentError(`--repeat conflicts with the prompt (${structuredRepeat} vs ${rawRepeat})`);\n  }\n  const repeat = structuredRepeat ?? (rawRepeat == null ? 1 : Number(rawRepeat));\n  if (repeat > capabilities.repeatLimit) {\n    throw new ArgumentError(`${capabilities.plan || 'current'} plan allows at most ${capabilities.repeatLimit} repeat/permutation jobs`);\n  }\n\n  let perJobMinutes = hasOmniReference || promptHasFlag(prompt, ['oref'])\n    ? GPU_COST_MINUTES.omni\n    : resolution === 'hd'\n      ? GPU_COST_MINUTES.imageHd\n      : GPU_COST_MINUTES.imageSd;\n  if (promptHasFlag(prompt, ['draft'])) perJobMinutes /= 2;\n  // The current web service charged a full SD batch for a live V6 --q 0.5\n  // job. Keep the cost guard conservative instead of applying historical\n  // quality discounts that are no longer reflected in account credits.\n  if (speed === 'turbo') perJobMinutes *= 2;\n  // Relax jobs do not consume the subscription's Fast GPU minute balance.\n  // Keep the guard and reported estimate aligned with the quota it protects.\n  if (speed === 'relax') perJobMinutes = 0;\n  const estimatedMinutes = Number((perJobMinutes * repeat).toFixed(2));\n\n  return {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/midjourney/capabilities.js#L228-L264","documentation":"The resolved repeat count (structured args.repeat or in-prompt --r/--repeat, defaulting to 1) is capped by the account's plan via capabilities.repeatLimit. This error is thrown when the requested repeat exceeds the current subscription plan's limit (e.g. Basic allows fewer repeat jobs than Pro/Mega).","triggerScenarios":"Calling generate/plan with repeat: 6 on a plan whose repeatLimit is 4 (e.g. Basic plan), via args.repeat or an in-prompt '--r 6'. The exact message names the plan and its limit.","commonSituations":"Running high-fanout batches on a Basic plan, copying example commands with --r 8 from users on Pro, or upgrading/lapsing a subscription so capabilities reflect a lower tier.","solutions":["Lower repeat to at most capabilities.repeatLimit for the account's plan (check the message for the exact cap).","Upgrade the Midjourney subscription plan (Basic -> Standard -> Pro -> Mega) for a higher repeat limit.","Split the work into multiple sequential calls, each within the plan's repeat limit.","Verify capabilities/plan with the account-info/plan endpoint before issuing large batches."],"exampleFix":"// before\nawait midjourney.generate({ prompt: 'a cat', repeat: 8 }); // Basic plan, limit 4\n// after\nawait midjourney.generate({ prompt: 'a cat', repeat: 4 });","handlingStrategy":"validation","validationCode":"const repeat = Number(args.repeat ?? 1);\nconst limit = await midjourney.capabilities(); // fetch plan limits\nif (repeat > limit.repeatLimit) {\n  throw new Error(`repeat ${repeat} exceeds plan limit ${limit.repeatLimit}`);\n}","typeGuard":"function isWithinRepeatLimit(repeat, capabilities) {\n  return Number.isInteger(repeat) && repeat >= 1 && repeat <= (capabilities?.repeatLimit ?? Infinity);\n}","tryCatchPattern":"try {\n  return await midjourney.generate({ prompt, repeat });\n} catch (err) {\n  if (err instanceof ArgumentError && /plan allows at most \\d+ repeat/.test(err.message)) {\n    const limit = Number(err.message.match(/at most (\\d+)/)[1]);\n    return midjourney.generate({ prompt, repeat: Math.min(repeat, limit) });\n  }\n  throw err;\n}","preventionTips":["Fetch capabilities once at startup and clamp repeat to repeatLimit before every call.","Check the current subscription plan after upgrades/downgrades; limits change with tier.","Clamp rather than fail in batch scripts: Math.min(desired, capabilities.repeatLimit).","Document plan limits where users configure repeat in your tooling."],"tags":["cli","plan-limit","quota","argument-error"],"backgroundTag":"plan-limit-exceeded","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}