jackwener/OpenCLI · error · CommandExecutionError
Instagram private publish upload failed for ${prepared.asset
Error message
Instagram private publish upload failed for ${prepared.asset.fileName} What it means
For photo assets, the rupload_igphoto upload response must contain status 'ok'; otherwise this error is thrown at clis/instagram/_shared/private-publish.js:811. The HTTP call and JSON parse succeeded, but Instagram rejected the upload contents or metadata at the application level.
Source
Thrown at clis/instagram/_shared/private-publish.js:811
}
for (const cleanupPath of prepared.asset.cleanupPaths || []) {
fs.rmSync(cleanupPath, { force: true });
}
if (prepared.asset.coverImage.cleanupPath) {
fs.rmSync(prepared.asset.coverImage.cleanupPath, { force: true });
}
}
}
async function uploadPreparedMediaAsset(fetcher, prepared, uploadId, context, mode = 'feed') {
if (prepared.type === 'image') {
const response = await fetchPrivateUploadWithRetry(fetcher, `https://i.instagram.com/rupload_igphoto/fb_uploader_${uploadId}`, {
method: 'POST',
headers: buildRuploadHeaders(prepared.asset, uploadId, context),
body: prepared.asset.bytes,
});
const json = await parseJsonResponse(response, 'upload');
if (String(json?.status || '') !== 'ok') {
throw new CommandExecutionError(`Instagram private publish upload failed for ${prepared.asset.fileName}`);
}
return;
}
const videoResponse = await fetchPrivateUploadWithRetry(fetcher, `https://i.instagram.com/rupload_igvideo/fb_uploader_${uploadId}`, {
method: 'POST',
headers: mode === 'story'
? buildStoryVideoRuploadHeaders(prepared.asset, uploadId, context)
: buildVideoRuploadHeaders(prepared.asset, uploadId, context),
body: prepared.asset.bytes,
});
const videoJson = await parseJsonResponse(videoResponse, 'video upload');
if (String(videoJson?.status || '') !== 'ok') {
throw new CommandExecutionError(`Instagram private publish video upload failed for ${prepared.asset.fileName}`);
}
const coverResponse = await fetchPrivateUploadWithRetry(fetcher, `https://i.instagram.com/rupload_igphoto/fb_uploader_${uploadId}`, {
method: 'POST',
headers: buildVideoCoverRuploadHeaders(prepared.asset, uploadId, context),
body: prepared.asset.coverImage.bytes,View on GitHub (pinned to 49907e53dc)
Solutions
- Inspect the parsed response body for a `message` field explaining why status !== 'ok' (add logging around the upload call if needed)
- Re-encode the image to a standard JPEG/PNG within Instagram's dimension limits and retry
- Refresh session cookies and restart the publish so a fresh uploadId is generated
- Verify the file was fully read (no truncation) before upload
Example fix
// before
const bytes = fs.readFileSync(maybePartialFile);
// after
const stat = fs.statSync(imgPath);
if (stat.size === 0) throw new Error('image file is empty');
const bytes = fs.readFileSync(imgPath); Defensive patterns
Strategy: validation
Validate before calling
const stat = fs.statSync(imagePath);
if (stat.size === 0) throw new Error('image bytes are empty');
if (stat.size > 8 * 1024 * 1024) throw new Error('image exceeds Instagram upload limits'); Try / catch
try { await publish(input); }
catch (e) {
if (/upload failed for/.test(e.message)) {
console.error('Instagram rejected the photo upload; check format/dimensions and refresh session');
}
throw e;
} Prevention
- Convert images to standard JPEG/PNG within Instagram dimension limits
- Ensure the full file is read into memory before upload (no truncation)
- Re-authenticate when uploads repeatedly fail with non-ok status
When it happens
Trigger: POST to https://i.instagram.com/rupload_igphoto/fb_uploader_<uploadId> returns JSON with status other than 'ok' — e.g. invalid image bytes, wrong Content-Length/rupload headers, media violating policies, or an expired upload session.
Common situations: Uploading images with unsupported formats or oversized dimensions; photo bytes truncated before upload; session/entity-id headers stale; account restricted from posting.
Related errors
- Instagram private publish video cover upload failed for ${pr
- Instagram private publish ${stage} returned invalid JSON
- Instagram private publish video upload failed for ${prepared
- ${label}: expected at least ${expectedCount} visible media i
- Failed to upload image to ChatGPT: ${err instanceof Error ?
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f1203ec1f0ee5b0b.
Report an issue: GitHub.