jackwener/OpenCLI · error · CommandExecutionError
Open the post in a logged-in browser session and retry
Error message
Open the post in a logged-in browser session and retry
What it means
When the in-page fetch reports errorCode 'PRIVATE_OR_UNAVAILABLE', handleFetchFailure throws a CommandExecutionError with this remediation hint: the post is either private, deleted, or otherwise unreachable for the current session. Unlike AUTH_REQUIRED, the session is valid but the account lacks access to the content, so the suggested fix is to open the post in a logged-in browser session that follows the owner.
Source
Thrown at clis/instagram/download.js:320
const unwrapped = unwrapEvaluateResult(result);
if (!unwrapped || typeof unwrapped !== 'object' || Array.isArray(unwrapped)) {
throw new CommandExecutionError('Failed to fetch Instagram media metadata');
}
if (typeof unwrapped.ok !== 'boolean') {
throw new CommandExecutionError('Instagram media metadata returned malformed result');
}
return unwrapped;
}
function handleFetchFailure(result) {
const message = result.error || 'Instagram media fetch failed';
if (result.errorCode === 'AUTH_REQUIRED') {
throw new AuthRequiredError('instagram.com', message);
}
if (result.errorCode === 'RATE_LIMITED') {
throw new CliError('RATE_LIMITED', message, 'Wait a few minutes and retry, or switch to a browser session with a warmer Instagram login state.', EXIT_CODES.TEMPFAIL);
}
if (result.errorCode === 'PRIVATE_OR_UNAVAILABLE') {
throw new CommandExecutionError(message, 'Open the post in a logged-in browser session and retry');
}
throw new CommandExecutionError(message);
}
async function downloadInstagramMedia(items, outputDir) {
fs.mkdirSync(outputDir, { recursive: true });
for (const item of items) {
const destPath = path.join(outputDir, item.filename);
const result = await httpDownload(item.url, destPath, {
timeout: item.type === 'video' ? 120000 : 60000,
});
if (!result.success) {
throw new CommandExecutionError(`Failed to download ${item.filename}: ${result.error || 'unknown error'}`);
}
if (!Number.isFinite(result.size) || result.size <= 0) {
throw new CommandExecutionError(`Failed to verify downloaded bytes for ${item.filename}`);
}
}
}View on GitHub (pinned to 49907e53dc)
Solutions
- Log in with an account that follows the private account, then retry
- Verify the post still exists by opening the URL in a normal browser
- Check the URL/shortcode for typos
- If the account changed username or the post moved, use the updated URL
Defensive patterns
Strategy: validation
Validate before calling
// verify the post is reachable with the current account before scripting downloads
const reachable = await browserPage.evaluate((shortcode) =>
!document.querySelector('meta[property="og:title"]')?.content.includes('Page Not Found'), shortcode);
if (!reachable) throw new Error('Post is private, deleted, or unavailable to this account'); Try / catch
try {
await run(['instagram', 'download', url]);
} catch (e) {
if (String(e.message).includes('Open the post in a logged-in browser session')) {
// switch to an account that follows the private account, or skip this URL
} else throw e;
} Prevention
- Only script downloads for posts visible to the authenticated account
- Follow private accounts beforehand with the automation account
- Validate the shortcode/URL before running
- Check the post still exists in a normal browser when errors repeat
When it happens
Trigger: The metadata fetch returned {ok:false, errorCode:'PRIVATE_OR_UNAVAILABLE'} — the target shortcode resolves to a private account post, a deleted/removed post, or content geo/blocked for the session's user.
Common situations: Downloading a post from a private account you don't follow; post deleted by the author; typo in the URL/shortcode; account suspended or post removed for policy violations.
Related errors
- File could not be read: ${path}
- PAID_CONTENT
- ${wantModel} model requires a paid Claude plan.
- Douyin API auth/permission error ${code} at ${method} ${url}
- Instagram post feed returned malformed payload for ${usernam
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5146975c579e95ed.
Report an issue: GitHub.