jackwener/OpenCLI · error · TimeoutError
Midjourney job submission
Error message
Midjourney job submission
What it means
This is the TimeoutError raised when the submit-and-wait loop exhausts its deadline without finding the expected number of uniquely matched new jobs (and no ambiguity was detected). The operation name 'Midjourney job submission' identifies the phase; the detail explains how many jobs were expected.
Source
Thrown at clis/midjourney/utils.js:467
&& promptCore(candidate) === expectedCore
&& promptKeySignature(candidate) === expectedSignature
);
});
if (matching.length === expectedCount) {
return [...matching]
.sort((left, right) => Date.parse(left.enqueue_time) - Date.parse(right.enqueue_time))
.map((row) => String(row.id).toLowerCase());
}
if (matching.length > expectedCount) ambiguousIds = matching.map((row) => String(row.id).toLowerCase());
if (!(await waitForNextPoll(page, deadline, 1.5))) break;
} while (true);
if (ambiguousIds.length > expectedCount) {
throw new CommandExecutionError(
`Midjourney submission is ambiguous; ${ambiguousIds.length} new jobs matched the prompt`,
ambiguousIds.map((id) => jobUrl(id)).join(', '),
);
}
throw new TimeoutError(
'Midjourney job submission',
timeoutSeconds,
`Expected ${expectedCount} uniquely matched job(s) after submission.`,
);
}
export async function waitForDerivedJob(page, userId, parentJobId, baselineIds, timeoutSeconds, submittedAtMs) {
const deadline = Date.now() + timeoutSeconds * 1000;
let candidates = [];
let consecutivePollFailures = 0;
do {
let recent;
try {
recent = await fetchHistory(page, userId, 50);
consecutivePollFailures = 0;
} catch (error) {
if (error instanceof AuthRequiredError) throw error;
consecutivePollFailures += 1;View on GitHub (pinned to 49907e53dc)
Solutions
- Increase timeoutSeconds and retry the submission.
- Verify on midjourney.com whether the job actually was created; if yes, poll it by ID with waitForCompletedJob instead of re-submitting.
- Check Midjourney queue/subscription state — exhausted fast hours can delay job registration past the timeout.
- Avoid resubmitting blindly, or you may create duplicate jobs (see the ambiguity error).
Example fix
// before
await submitAndAwait(page, prompt, { timeoutSeconds: 30 });
// after
await submitAndAwait(page, prompt, { timeoutSeconds: 120 }); // allow for slow queue registration Defensive patterns
Strategy: retry
Validate before calling
// pre-flight: confirm the subscription/queue can accept jobs before submitting
const jobs = await fetchJobStatuses(page, recentJobIds).catch(() => []);
const queued = jobs.filter((j) => String(j.current_status || j.status || '').toLowerCase() === 'waiting');
if (queued.length > 5) console.warn('Queue is congested; use a longer timeoutSeconds.'); Try / catch
async function submitWithTimeoutRetry(page, prompt, timeoutSeconds) {
try {
return await submitAndAwait(page, prompt, { timeoutSeconds });
} catch (e) {
if (String(e.message).includes('Midjourney job submission')) {
// check web UI for the job before resubmitting to avoid duplicates
return submitAndAwait(page, prompt, { timeoutSeconds: timeoutSeconds * 2 });
}
throw e;
}
} Prevention
- Set timeoutSeconds generously (60-180s) for congested queues
- Check for the created job on midjourney.com before any retry to prevent duplicates
- Ensure fast hours/subscription are available for timely job registration
- Log submission timestamps so you can correlate timeouts with site-side state
When it happens
Trigger: The polling loop's deadline (timeoutSeconds) expires because the submitted job never appeared in job-status results: submission silently failed, the prompt produced no job, the job took longer than the timeout to register, or waitForNextPoll kept breaking early.
Common situations: Too-low timeoutSeconds for slow generations or congested queues; Midjourney not registering the job due to an unobserved UI failure; subscription exhausted (no fast hours) causing queued jobs that exceed the window.
Related errors
- Midjourney job ${jobId} (last status: ${lastStatus})
- Timeout waiting for Antigravity reply after ${timeout / 1000
- Bilibili relation modify did not verify ${expectedLabel}; la
- chatgpt detail
- Douyin transcode for video ${videoId}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/a4fab8070c1c33f0.
Report an issue: GitHub.