{"record":{"id":"ad13a618dcc94c52","repo":"jackwener/OpenCLI","slug":"image-is-required-a-remote-image-url","errorCode":null,"errorMessage":"image is required (a remote image URL)","messagePattern":"image is required \\(a remote image URL\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/pinterest/pin-create.js","lineNumber":8,"sourceCode":"// Pinterest pin-create — create a pin from a remote image URL onto a board (PinResource/create).\nimport { cli, Strategy } from '@jackwener/opencli/registry';\nimport { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';\nimport { PINTEREST_BASE, movePinToSection, pinterestResourceCreate, resolveBoardId, resolveBoardTarget, resolveSection } from './utils.js';\n\nfunction requireImageUrl(raw) {\n  const value = String(raw ?? '').trim();\n  if (!value) throw new ArgumentError('image is required (a remote image URL)');\n  let parsed;\n  try {\n    parsed = new URL(value);\n  } catch {\n    throw new ArgumentError(`image must be a remote image URL (got \"${raw}\")`);\n  }\n  if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n    throw new ArgumentError(`image URL must be http(s): ${value}`);\n  }\n  return value;\n}\n\ncli({\n  site: 'pinterest',\n  name: 'pin-create',\n  access: 'write',\n  description: 'Create a pin from a remote image URL onto a board',\n  domain: 'www.pinterest.com',","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/pin-create.js#L1-L26","documentation":"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.","triggerScenarios":"Calling `pinterest pin-create` without --image, or with --image \"\" or whitespace-only value; programmatic calls passing null/undefined for the image kwarg.","commonSituations":"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).","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."],"exampleFix":"// before\nawait cli.pinCreate({ board: 'user/board' }); // no image\n// after\nawait cli.pinCreate({ board: 'user/board', image: 'https://example.com/photo.jpg' });","handlingStrategy":"validation","validationCode":"if (!image || !String(image).trim()) {\n  throw new Error('pin-create requires --image with a remote http(s) URL');\n}","typeGuard":"function hasImageArg(kwargs) {\n  return typeof kwargs.image === 'string' && kwargs.image.trim().length > 0;\n}","tryCatchPattern":"try {\n  await cli.pinCreate({ board, image });\n} catch (e) {\n  if (/image is required/.test(e.message)) {\n    console.error('supply --image <remote-url>');\n  } else throw e;\n}","preventionTips":["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"],"tags":["pinterest","missing-parameter","invalid-argument","cli"],"backgroundTag":"missing-required-parameter","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}