jackwener/OpenCLI · error · ArgumentError

Omni Reference accepts exactly one local image

Error message

Omni Reference accepts exactly one local image

What it means

ArgumentError thrown when the 'omni' slot is targeted but the caller supplied a number of local images other than exactly one. Omni Reference accepts a single image by design.

Source

Thrown at clis/midjourney/utils.js:1185

  const selected = await uploadReferenceLibrary(page, localPaths);

  // Uploading while the persistent composer retained a video state can leave
  // the library open beside Start/End Frame slots. Reassert image mode before
  // assigning image-generation references; End Frame intentionally stays in
  // the manual video composer.
  if (slot !== 'end') {
    await ensureImageComposer(page);
    await openImagePanel(page);
  }

  const label = slot === 'style'
    ? 'Style References'
    : slot === 'end'
      ? 'End Frame'
      : slot === 'image'
        ? 'Image Prompts'
        : 'Omni Reference';
  if (slot === 'omni' && selected.length !== 1) throw new ArgumentError('Omni Reference accepts exactly one local image');
  if (typeof page.drag !== 'function') throw new CommandExecutionError('Browser Bridge does not support Reference drag-and-drop');
  for (const url of selected) {
    await markReferenceTarget(page, url, label);
    await page.drag('[data-opencli-ref-source="1"]', '[data-opencli-ref-target="1"]');
    await page.wait(0.8);
    await verifyReferenceTarget(page, label);
  }
  return selected;
}

function normalizeButtonText(value) {
  return String(value || '').replace(/\s+/g, ' ').trim();
}

export async function clickCreationAction(page, text, occurrence = 0) {
  const target = unwrapEvaluateResult(await page.evaluate((label, wantedIndex) => {
    const visible = (element) => {
      const rect = element.getBoundingClientRect();

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Pass exactly one image path for the omni slot.
  2. For multiple images, split calls or use the image/style reference slots instead.
  3. Validate the array length before calling uploadReferencesToSlot.

Example fix

// before
await uploadReferencesToSlot(page, [a, b], 'omni');
// after
await uploadReferencesToSlot(page, [a], 'omni');
Defensive patterns

Strategy: validation

Validate before calling

if (slot === 'omni' && localPaths.length !== 1) {
  throw new Error('Omni Reference requires exactly one image path');
}

Try / catch

try {
  await uploadReferencesToSlot(page, paths, 'omni');
} catch (err) {
  if (String(err.message).includes('exactly one')) {
    console.error('Pass a single-element array for omni slot');
  } else throw err;
}

Prevention

When it happens

Trigger: uploadReferencesToSlot(page, paths, 'omni') with paths.length === 0 or paths.length >= 2.

Common situations: Passing an array of style/character images to the omni slot by mistake; reusing a batch-upload helper for omni references; empty array when upload failed earlier.

Related errors


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