jackwener/OpenCLI · error · CommandExecutionError
Midjourney job ${jobId} is "${status || 'missing'}"; media i
Error message
Midjourney job ${jobId} is "${status || 'missing'}"; media is available after completion. What it means
This CommandExecutionError is thrown when fetchJobStatus returns a Midjourney job whose status is anything other than 'completed'. Media files only exist for finished jobs, so the download command refuses to proceed and reports the job's actual status (or 'missing' when the status field is empty).
Source
Thrown at clis/midjourney/download.js:43
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',
navigateBefore: 'https://www.midjourney.com/imagine',
defaultFormat: 'plain',
args: [
{ name: 'job', positional: true, required: true, help: 'Job UUID or Midjourney /jobs/<uuid> URL' },
{ name: 'index', default: 'all', help: 'Candidate 1..4 or all' },
{ name: 'kind', default: 'auto', help: 'auto, image, video-raw, video-social, or gif' },
{ name: 'output', default: '~/Pictures/Midjourney', help: 'Output directory' },
{ name: 'force', type: 'boolean', default: false, help: 'Overwrite existing non-empty files' },
],
columns: ['job_id', 'status', 'kind', 'index', 'file', 'bytes', 'mime', 'url'],
func: async (page, kwargs) => {
const jobId = parseJobId(kwargs.job);
const job = await fetchJobStatus(page, jobId);
const status = String(job.current_status || job.status || '').toLowerCase();
if (status !== 'completed') {
throw new CommandExecutionError(`Midjourney job ${jobId} is "${status || 'missing'}"; media is available after completion.`);
}
const video = isVideoJob(job);
let kind = String(kwargs.kind || 'auto').trim().toLowerCase();
if (!KINDS.includes(kind)) throw new ArgumentError(`--kind must be one of: ${KINDS.join(', ')}`);
if (kind === 'auto') kind = video ? 'video-raw' : 'image';
if (video && kind === 'image') throw new ArgumentError('Video jobs support video-raw, video-social, or gif downloads');
if (!video && kind !== 'image') throw new ArgumentError('Image jobs only support --kind image');
const indices = parseImageIndices(kwargs.index, Number(job.batch_size || (video ? 1 : 4)));
const outputDir = resolveOutputDir(kwargs.output);
const force = normalizeBoolean(kwargs.force);
let files;
if (kind === 'image') {
files = (await downloadOriginals(page, jobId, indices, outputDir, force)).map((item) => ({
...item,
kind: 'image',
}));
} else if (kind === 'video-raw') {View on GitHub (pinned to 49907e53dc)
Solutions
- Wait for the job to finish (poll `opencli midjourney status <job>` or fetchJobStatus) and re-run the download once status is 'completed'
- Verify the job ID/URL is correct — a wrong UUID yields a 'missing' status
- Check the job in the Midjourney web UI; if it failed or was canceled, resubmit the prompt instead of retrying the download
- Re-authenticate the session if the job exists but its status cannot be read
Example fix
// before opencli midjourney download abc123 --kind image // Error: job is "processing" // after: wait until completed while [ "$(opencli midjourney status abc123 --format json | jq -r .status)" != "completed" ]; do sleep 5; done opencli midjourney download abc123 --kind image
Defensive patterns
Strategy: validation
Validate before calling
// Check job status before attempting download
const job = await fetchJobStatus(page, parseJobId(jobRef));
const status = String(job.current_status || job.status || '').toLowerCase();
if (status !== 'completed') {
throw new Error(`Job not ready (status: ${status || 'missing'}). Wait for completion.`);
} Type guard
function isCompletedJob(job) {
return !!job && String(job.current_status || job.status || '').toLowerCase() === 'completed';
} Try / catch
try {
await run('midjourney', 'download', jobId);
} catch (err) {
if (err.message.includes('media is available after completion')) {
// poll status until completed, then retry the download
} else throw err;
} Prevention
- Poll job status until 'completed' before downloading
- Double-check the job UUID/URL — 'missing' status usually means a wrong ID
- Treat failed/canceled jobs as terminal instead of retrying downloads
- Verify the session can see the job's workspace
When it happens
Trigger: Calling `opencli midjourney download <job>` while the job's current_status/status (lowercased) is e.g. 'processing', 'queued', 'failed', or absent — the fetch returned no completed job for that UUID.
Common situations: Polling for a job right after submitting an imagine/video prompt; a typo'd or wrong job UUID returning a missing status; a failed/canceled job that will never complete; a stale session where the job belongs to another workspace.
Related errors
- Image jobs only support --kind image
- Failed to download grok image ${img.src}${reason}
- --repeat must be a positive integer
- operation must be one of: ${ACTION_CHOICES.join(', ')}
- No cost model is defined for action "${operation}"
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1eae95ae20799197.
Report an issue: GitHub.