jackwener/OpenCLI · error · CommandExecutionError

Instagram private publish video cover upload failed for ${pr

Error message

Instagram private publish video cover upload failed for ${prepared.asset.fileName}

What it means

After the video upload succeeds, the cover image is uploaded via rupload_igphoto with video-cover headers; if that response's status is not 'ok' this error is thrown at clis/instagram/_shared/private-publish.js:833. The video itself was accepted, but its cover frame was rejected, so the publish cannot proceed.

Source

Thrown at clis/instagram/_shared/private-publish.js:833

    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,
    });
    const coverJson = await parseJsonResponse(coverResponse, 'video cover upload');
    if (String(coverJson?.status || '') !== 'ok') {
        throw new CommandExecutionError(`Instagram private publish video cover upload failed for ${prepared.asset.fileName}`);
    }
}
async function publishSidecarWithRetry(input) {
    const waitMs = input.waitMs ?? sleep;
    const requestInit = {
        method: 'POST',
        headers: {
            ...buildPrivateApiHeaders(input.apiContext),
            'Content-Type': 'application/json',
        },
        body: JSON.stringify(input.payload),
    };
    for (let attempt = 0; attempt < INSTAGRAM_PRIVATE_SIDECAR_TRANSCODE_ATTEMPTS; attempt += 1) {
        const response = await input.fetcher('https://www.instagram.com/api/v1/media/configure_sidecar/', requestInit);
        const text = await response.text();
        let json = {};
        try {
            json = text ? JSON.parse(text) : {};

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the cover image is a valid non-empty JPEG (check file size and open it locally) before publishing
  2. Regenerate the cover (or supply your own) and retry the publish
  3. Retry after a short backoff if the video upload succeeded — this stage is often transiently throttled
  4. Read the response body's message field for the specific rejection reason

Example fix

// before
const cover = await coverImage(videoPath); // may silently produce tiny/corrupt frame
await publish({ ..., coverImage: cover });
// after
const cover = await coverImage(videoPath);
if (fs.statSync(cover.cleanupPath).size < 1024) throw new Error('generated cover is corrupt; regenerate or supply one');
await publish({ ..., coverImage: cover });
Defensive patterns

Strategy: retry

Validate before calling

const coverStat = fs.statSync(coverPath);
if (coverStat.size < 1024) throw new Error('generated cover looks corrupt — regenerate or supply one');

Try / catch

try { return await publish(input); }
catch (e) {
  if (/video cover upload failed for/.test(e.message)) {
    await sleep(10000);
    return publish({ ...input, coverImage: regenerateCover(input.videoPath) }); // video already accepted
  }
  throw e;
}

Prevention

When it happens

Trigger: POST of prepared.asset.coverImage.bytes to https://i.instagram.com/rupload_igphoto/fb_uploader_<uploadId> returns JSON with status other than 'ok' — cover bytes empty/corrupt, cover generated on a platform where extraction partially failed, or cover headers mismatched.

Common situations: Cover generation produced a zero-byte or corrupt JPEG (e.g. AVFoundation frame extraction edge case); cover image dimensions outside allowed range; transient Instagram-side error during the second upload; rate limiting kicking in mid-publish.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/a0b097491572d64c. Report an issue: GitHub.