jackwener/OpenCLI · error · CommandExecutionError
Failed to download pin ${id}: ${getErrorMessage(err)}
Error message
Failed to download pin ${id}: ${getErrorMessage(err)} What it means
The httpDownload helper threw (network/timeout/ filesystem error) while fetching the pin image with a 60s timeout; the command wraps the failure in CommandExecutionError prefixed with 'Failed to download pin <id>'. This indicates a transport-level problem, not a pin-existence problem.
Source
Thrown at clis/pinterest/download.js:51
sourceUrl,
);
if (!pin || !pin.id) {
throw new EmptyResultError('pinterest download', `pin "${id}" not found`);
}
const imageUrl = pickPinImage(pin.images);
if (!imageUrl) {
throw new CommandExecutionError(`Pin ${id} has no downloadable image (it may be a video or story pin)`);
}
fs.mkdirSync(output, { recursive: true });
const ext = path.extname(new URL(imageUrl).pathname) || '.jpg';
const destPath = path.join(output, `${id}${ext}`);
let result;
try {
result = await httpDownload(imageUrl, destPath, { timeout: 60000 });
} catch (err) {
throw new CommandExecutionError(`Failed to download pin ${id}: ${getErrorMessage(err)}`);
}
if (!result.success) {
throw new CommandExecutionError(`Failed to download pin ${id}: ${result.error || 'unknown error'}`);
}
return [{
pinId: id,
status: 'success',
size: formatBytes(result.size),
path: destPath,
}];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the command — transient network errors often resolve on retry.
- Check general internet connectivity / proxy settings on the machine.
- Increase the download timeout if images are large or the connection is slow.
- Inspect the wrapped error message (getErrorMessage(err)) for the underlying cause (DNS, TLS, timeout).
Example fix
// before
await cli.download(pinId); // fails on flaky network
// after
try { await cli.download(pinId); } catch (e) { await retry(() => cli.download(pinId), { attempts: 3 }); } Defensive patterns
Strategy: retry
Validate before calling
await fetch('https://i.pinimg.com/', { method: 'HEAD' }).catch(() => { throw new Error('no network access to Pinterest CDN'); }); Type guard
null
Try / catch
for (let attempt = 1; attempt <= 3; attempt++) {
try { await cli.download(pinId); break; }
catch (e) {
if (/Failed to download pin/.test(e.message) && attempt < 3) {
await new Promise(r => setTimeout(r, attempt * 2000)); // backoff
} else throw e;
}
} Prevention
- Verify outbound network/DNS before bulk downloads
- Use exponential backoff on transient failures
- Raise timeouts for slow links or large images
- Check proxy/firewall rules in CI and containers
When it happens
Trigger: Network outage or DNS failure during download; image CDN URL expired; response slower than the 60000ms timeout; local write failure creating the destination path.
Common situations: Flaky Wi-Fi or corporate proxies; i.pinimg.com rate limiting; long downloads on slow connections exceeding the 60s timeout; running in containers without outbound internet.
Related errors
- FETCH_ERROR
- archive wayback request failed: ${error?.message || error}
- Bilibili creator comparison
- Bilibili relation modify did not verify ${expectedLabel}; la
- Boss API request failed: ${message}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e3045508ddceaea7.
Report an issue: GitHub.