jackwener/OpenCLI · error · CommandExecutionError
Midjourney action is ambiguous; ${candidates.length} derived
Error message
Midjourney action is ambiguous; ${candidates.length} derived jobs matched parent ${parentJobId} What it means
After submitting a derived action (upscale/vary/reroll) on a parent job, the library polls for exactly one new child job enqueued at/after the action time. If more than one candidate child job matches the parent and timing window, CommandExecutionError is thrown listing the candidate URLs, since picking one would be a guess.
Source
Thrown at clis/midjourney/utils.js:504
if (consecutivePollFailures >= 3) throw error;
if (!(await waitForNextPoll(page, deadline, 1.5))) break;
continue;
}
candidates = recent.filter((row) => {
const id = String(row?.id || '').toLowerCase();
const parent = String(row?.parent_id || '').toLowerCase();
const enqueuedAt = Date.parse(String(row?.enqueue_time || ''));
return UUID_RE.test(id)
&& !baselineIds.has(id)
&& parent === String(parentJobId).toLowerCase()
&& Number.isFinite(enqueuedAt)
&& enqueuedAt >= submittedAtMs - 5000;
});
if (candidates.length === 1) return String(candidates[0].id).toLowerCase();
if (!(await waitForNextPoll(page, deadline, 1.5))) break;
} while (true);
if (candidates.length > 1) {
throw new CommandExecutionError(
`Midjourney action is ambiguous; ${candidates.length} derived jobs matched parent ${parentJobId}`,
candidates.map((row) => jobUrl(row.id)).join(', '),
);
}
throw new TimeoutError('Midjourney derived job submission', timeoutSeconds, `No new child job appeared for ${parentJobId}.`);
}
export async function waitForCompletedJob(page, jobId, timeoutSeconds) {
const deadline = Date.now() + timeoutSeconds * 1000;
let lastStatus = 'unknown';
do {
const job = await fetchJobStatus(page, jobId, { allowMissing: true });
if (job) {
lastStatus = String(job.current_status || job.status || 'unknown').toLowerCase();
if (lastStatus === 'completed') return job;
if (['failed', 'cancelled', 'canceled', 'error'].includes(lastStatus)) {
throw new CommandExecutionError(`Midjourney job ${jobId} ended with status "${lastStatus}"`);
}View on GitHub (pinned to 49907e53dc)
Solutions
- Inspect the candidate job URLs in the error and continue with the intended child ID directly (e.g. via waitForCompletedJob).
- Avoid re-running the action command after a timeout — the first run may have succeeded; check the parent's children on midjourney.com first.
- Ensure no concurrent sessions are issuing actions on the same parent job.
- Wait for unrelated child jobs from that parent to complete before re-attempting, so the matching window is unambiguous.
Defensive patterns
Strategy: validation
Validate before calling
// ensure no child jobs already exist from a prior attempt before re-issuing the action
const children = await fetchJobStatuses(page, recentJobIds).catch(() => []);
const priorChildren = children.filter((j) => String(j.parent_job_id || j.job_id || '') === parentJobId);
if (priorChildren.length > 0) {
console.warn(`${priorChildren.length} child job(s) already exist for ${parentJobId}; track one by ID instead of re-running the action.`);
} Try / catch
try {
const childId = await deriveChildJobId(page, parentJobId, action);
} catch (e) {
const m = String(e.message).match(/ambiguous; (\d+) derived jobs/);
if (m) {
console.error('Choose the correct child from the listed URLs and continue with that ID.');
} else throw e;
} Prevention
- Do not re-run action commands after a timeout without checking for existing children
- Serialize all actions on a given parent within one session
- Record child job IDs as soon as they are resolved for later retries
- Wait for unrelated sibling jobs to leave the enqueued window before re-attempting
When it happens
Trigger: Calling the derived-job flow when candidates.length > 1 — e.g. the same action was triggered twice (double-click/rerun), another session performed actions on the same parent, or multiple children legitimately spawned within the timing tolerance (submittedAtMs - 5000).
Common situations: Retrying a failed action command after the first actually succeeded (two children exist); parallel CLI sessions acting on the same parent image; grid actions generating multiple jobs within the window.
Related errors
- Midjourney submission is ambiguous; ${ambiguousIds.length} n
- Midjourney derived job submission
- Model name "${rawName}" is ambiguous.
- Picker option "${rawLabel}" is ambiguous.
- ${result?.error || 'Could not select Codex conversation'}${d
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/088ea6511306680d.
Report an issue: GitHub.