jackwener/OpenCLI · error · ArgumentError

Image jobs only support --kind image

Error message

Image jobs only support --kind image

What it means

The `opencli midjourney download` command only downloads static images from image-generation jobs. After fetching the job via fetchJobStatus it calls isVideoJob(job); if the job is a normal image job but the user explicitly passed a video-related --kind (video-raw, video-social, or gif), this ArgumentError is thrown. Video-only download kinds simply do not exist for image jobs.

Source

Thrown at clis/midjourney/download.js:50

    { 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') {
      files = [];
      for (const index of indices) files.push(await downloadRawVideo(page, jobId, index, outputDir, force));
    } else {
      files = [];
      for (const index of indices) files.push(await downloadRenderedVideo(page, jobId, index, kind, outputDir, force));
    }
    return files.map((item) => ({

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Drop the --kind flag (or use --kind auto) so image jobs download as images
  2. Explicitly pass --kind image for this job
  3. Verify the job is actually a video job with `opencli midjourney status <job>` before using video kinds
  4. If you process a list of mixed jobs, branch on job type and only pass video kinds for video jobs

Example fix

// before
opencli midjourney download abc123 --kind gif
// after
opencli midjourney download abc123 --kind image   # or omit --kind
Defensive patterns

Strategy: validation

Validate before calling

const VIDEO_KINDS = ['video-raw', 'video-social', 'gif'];
const kind = (kwargs.kind || 'auto').trim().toLowerCase();
const jobIsVideo = /* from `opencli midjourney status <job>` output, e.g. job type contains 'video' */;
if (!jobIsVideo && VIDEO_KINDS.includes(kind)) {
  throw new Error(`Job is an image job; only --kind image is valid (got --kind ${kind})`);
}

Type guard

function isVideoKind(kind) {
  return ['video-raw', 'video-social', 'gif'].includes(String(kind).toLowerCase());
}

Try / catch

try {
  await cli('midjourney', 'download', job, { kind });
} catch (e) {
  if (/Image jobs only support --kind image/.test(e.message)) {
    await cli('midjourney', 'download', job, { kind: 'image' });
  } else throw e;
}

Prevention

When it happens

Trigger: Running `opencli midjourney download <job> --kind video-raw|video-social|gif` where the resolved job is NOT a video job (isVideoJob(job) returns false). The error only fires when the user explicitly selected a video kind for a non-video job, or reused a stale/saved --kind value; --kind auto always resolves correctly (video-raw for video jobs, image otherwise).

Common situations: Passing --kind video-raw out of habit from a previous video job; scripting with a hardcoded kind reused across a mixed list of jobs; assuming an image job with an animated preview supports GIF export; copy-pasting a download command from a video job to an image job.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/8b502c0acaefae86. Report an issue: GitHub.