jackwener/OpenCLI · error · ArgumentError
Unsupported host: ${host}
Error message
Unsupported host: ${host} What it means
Thrown by parseInstagramMediaTarget when the URL host is neither instagram.com nor a subdomain of it (INSTAGRAM_HOST_SUFFIX). The library only processes links hosted on Instagram domains.
Source
Thrown at clis/instagram/download.js:60
}
export function parseInstagramMediaTarget(input) {
const raw = String(input || '').trim();
if (!raw) {
throw new ArgumentError('Instagram URL is required', 'Expected https://www.instagram.com/p/... or https://www.instagram.com/reel/...');
}
let url;
try {
url = new URL(raw);
}
catch {
throw new ArgumentError(`Invalid Instagram URL: ${raw}`, 'Expected https://www.instagram.com/p/<shortcode>/ or /reel/<shortcode>/');
}
if (!['http:', 'https:'].includes(url.protocol)) {
throw new ArgumentError(`Unsupported URL protocol: ${url.protocol}`);
}
const host = url.hostname.toLowerCase();
if (host !== INSTAGRAM_HOST_SUFFIX && !host.endsWith(`.${INSTAGRAM_HOST_SUFFIX}`)) {
throw new ArgumentError(`Unsupported host: ${host}`, 'Only instagram.com URLs are supported');
}
const segments = url.pathname.split('/').filter(Boolean);
let kind;
let shortcode;
if (segments.length >= 2 && SUPPORTED_KINDS.has(segments[0])) {
kind = segments[0];
shortcode = segments[1];
}
else if (segments.length >= 3 && SUPPORTED_KINDS.has(segments[1])) {
kind = segments[1];
shortcode = segments[2];
}
if (!kind || !shortcode) {
throw new ArgumentError(`Unsupported Instagram media URL: ${raw}`, 'Only /p/<shortcode>/, /reel/<shortcode>/, and /tv/<shortcode>/ links are supported');
}
if (!shortcodeToMediaId(shortcode)) {
throw new ArgumentError(`Invalid Instagram shortcode: ${shortcode}`, 'Copy the link straight from the post, without escaping it');
}View on GitHub (pinned to 49907e53dc)
Solutions
- Use a URL whose host is instagram.com or a subdomain like www.instagram.com
- Correct any domain typos
- Open the post in the official app/site and copy the canonical link
Example fix
// before https://imginn.com/p/Cxyz123/ // after https://www.instagram.com/p/Cxyz123/
Defensive patterns
Strategy: validation
Validate before calling
const u = new URL(raw);
const h = u.hostname.toLowerCase();
if (h !== 'instagram.com' && !h.endsWith('.instagram.com')) throw new Error('Only instagram.com URLs are supported'); Type guard
function isInstagramHost(v) {
try { const h = new URL(v).hostname.toLowerCase(); return h === 'instagram.com' || h.endsWith('.instagram.com'); } catch { return false; }
} Try / catch
try {
await igDownload(raw);
} catch (e) {
if (e.name === 'ArgumentError' && /Unsupported host/.test(e.message)) {
console.error('Open the post on instagram.com and copy the canonical link.');
} else throw e;
} Prevention
- Only use links from the official instagram.com domain
- Watch for typo/phishing mirror domains
- Resolve third-party viewer links back to the original post
When it happens
Trigger: Passing a URL from another service (e.g. instagramez.com, fake-phishing mirror, imginn mirror, or a totally different site) to the Instagram download command.
Common situations: Using third-party Instagram viewer/mirror sites; typos in the domain (instagrarn.com); pasting a link to an embed or proxy service; phishing lookalike domains.
Related errors
- Invalid 1688 store URL
- --url must be a Discord channel URL like https://discord.com
- --url must be a Discord thread/post URL like https://discord
- id not a valid Grok URL (got "${input}")
- event query parameter must be a numeric event id
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/b749a2ab3b39bc15.
Report an issue: GitHub.