jackwener/OpenCLI · error · ArgumentError

job-id must be a Midjourney UUID or https://www.midjourney.c

Error message

job-id must be a Midjourney UUID or https://www.midjourney.com/jobs/<uuid> URL

What it means

parseJobId normalizes a job identifier for commands like `midjourney status`. It accepts either a bare 36-character UUID or a https://www.midjourney.com/jobs/<uuid> URL and throws this ArgumentError when the input is neither. The URL path must match /jobs/<uuid> exactly and the UUID must pass UUID_RE.

Source

Thrown at clis/midjourney/utils.js:71

    throw new ArgumentError(`${label} must be a positive integer`);
  }
  if (parsed > max) {
    throw new ArgumentError(`${label} must be <= ${max}`);
  }
  return parsed;
}

export function parseJobId(value) {
  const raw = String(value ?? '').trim();
  if (UUID_RE.test(raw)) return raw.toLowerCase();
  try {
    const parsed = new URL(raw);
    const match = parsed.pathname.match(/^\/jobs\/([0-9a-f-]{36})\/?$/i);
    if (parsed.protocol === 'https:' && parsed.hostname === MIDJOURNEY_DOMAIN && match && UUID_RE.test(match[1])) {
      return match[1].toLowerCase();
    }
  } catch {}
  throw new ArgumentError(
    'job-id must be a Midjourney UUID or https://www.midjourney.com/jobs/<uuid> URL',
    'Example: opencli midjourney status d5664250-5f1f-4cd0-9637-2ce0153dd30a',
  );
}

export function parseImageIndices(value, batchSize = 4) {
  const max = Number.isInteger(batchSize) && batchSize > 0 ? batchSize : 4;
  const raw = String(value ?? 'all').trim().toLowerCase();
  if (!raw || raw === 'all') return Array.from({ length: max }, (_, index) => index);
  if (!/^\d+$/.test(raw)) {
    throw new ArgumentError(`--index must be "all" or an integer from 1 to ${max}`);
  }
  const userIndex = Number(raw);
  if (userIndex < 1 || userIndex > max) {
    throw new ArgumentError(`--index must be between 1 and ${max} for this job`);
  }
  return [userIndex - 1];
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Copy the UUID directly from a valid job URL (the 36-char hex-dash segment after /jobs/) and pass just that
  2. Ensure a URL input is exactly https://www.midjourney.com/jobs/<uuid> with no extra path segments or query string
  3. Check for typos/truncation in the UUID (must be 8-4-4-4-12 hex characters)
  4. Re-run the generation to obtain a fresh job id if the original is unavailable

Example fix

// before
opencli midjourney status "https://www.midjourney.com/imagine/a-blue-teapot-123"
// after
opencli midjourney status d5664250-5f1f-4cd0-9637-2ce0153dd30a
Defensive patterns

Strategy: validation

Validate before calling

const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
function extractJobId(input) {
  const raw = String(input ?? '').trim();
  if (UUID_RE.test(raw)) return raw.toLowerCase();
  try {
    const u = new URL(raw);
    const m = u.pathname.match(/^\/jobs\/([0-9a-f-]{36})\/?$/i);
    if (u.protocol === 'https:' && u.hostname === 'www.midjourney.com' && m && UUID_RE.test(m[1]))
      return m[1].toLowerCase();
  } catch {}
  throw new Error('Not a valid Midjourney job id or /jobs/ URL');
}

Type guard

function isJobIdLike(v) {
  return typeof v === 'string' && /^[0-9a-f-]{36}$/i.test(v.trim());
}

Try / catch

try {
  const id = extractJobId(input);
  await status(id);
} catch (err) {
  if (err.name === 'ArgumentError' && /job-id/.test(err.message)) {
    console.error('Pass a UUID or a https://www.midjourney.com/jobs/<uuid> URL');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Passing a non-https URL, a midjourney.com URL whose path is not /jobs/<uuid> (e.g. a gallery or imagine page link), a shortened/partial id, an id containing invalid characters, or an empty/whitespace value.

Common situations: Pasting the wrong link from the Midjourney web app (showcase or feed URL instead of a job URL), copying a URL with query strings and expecting the parser to strip them, trimming the UUID by accident, or using an http:// link.

Related errors


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