jackwener/OpenCLI · error · ArgumentError
image is required (a remote image URL)
Error message
image is required (a remote image URL)
What it means
pin-create's requireImageUrl helper rejects an empty/missing image argument. Since a pin must be created from a remote image URL, an absent or blank --image raises ArgumentError immediately, before any URL parsing or Pinterest interaction.
Source
Thrown at clis/pinterest/pin-create.js:8
// Pinterest pin-create — create a pin from a remote image URL onto a board (PinResource/create).
import { cli, Strategy } from '@jackwener/opencli/registry';
import { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';
import { PINTEREST_BASE, movePinToSection, pinterestResourceCreate, resolveBoardId, resolveBoardTarget, resolveSection } from './utils.js';
function requireImageUrl(raw) {
const value = String(raw ?? '').trim();
if (!value) throw new ArgumentError('image is required (a remote image URL)');
let parsed;
try {
parsed = new URL(value);
} catch {
throw new ArgumentError(`image must be a remote image URL (got "${raw}")`);
}
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
throw new ArgumentError(`image URL must be http(s): ${value}`);
}
return value;
}
cli({
site: 'pinterest',
name: 'pin-create',
access: 'write',
description: 'Create a pin from a remote image URL onto a board',
domain: 'www.pinterest.com',View on GitHub (pinned to 49907e53dc)
Solutions
- Provide --image with a remote http(s) image URL.
- If you have a local file, upload it somewhere accessible first and pass its URL.
- Check that the variable feeding --image is populated in your script.
- Validate the argument in your wrapper before invoking the command.
Example fix
// before
await cli.pinCreate({ board: 'user/board' }); // no image
// after
await cli.pinCreate({ board: 'user/board', image: 'https://example.com/photo.jpg' }); Defensive patterns
Strategy: validation
Validate before calling
if (!image || !String(image).trim()) {
throw new Error('pin-create requires --image with a remote http(s) URL');
} Type guard
function hasImageArg(kwargs) {
return typeof kwargs.image === 'string' && kwargs.image.trim().length > 0;
} Try / catch
try {
await cli.pinCreate({ board, image });
} catch (e) {
if (/image is required/.test(e.message)) {
console.error('supply --image <remote-url>');
} else throw e;
} Prevention
- Always pass --image when creating pins
- Check that config/env variables feeding the flag are set
- Remember only remote URLs are accepted, not local files
- Validate kwargs before programmatic calls
When it happens
Trigger: Calling `pinterest pin-create` without --image, or with --image "" or whitespace-only value; programmatic calls passing null/undefined for the image kwarg.
Common situations: Scripts where the image URL variable is unset; YAML/JSON config with an empty image field; forgetting that local file paths are not accepted (only remote URLs).
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- nothing to update
- Unknown privacy "${privacy}". Valid: ${PRIVACY.join(', ')}
- image must be a remote image URL (got "${raw}")
- INVALID_ARGUMENT
- INVALID_ARGUMENT
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ad13a618dcc94c52.
Report an issue: GitHub.