{"record":{"id":"a0b097491572d64c","repo":"jackwener/OpenCLI","slug":"instagram-private-publish-video-cover-upload-faile","errorCode":null,"errorMessage":"Instagram private publish video cover upload failed for ${prepared.asset.fileName}","messagePattern":"Instagram private publish video cover upload failed for (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/_shared/private-publish.js","lineNumber":833,"sourceCode":"    const videoResponse = await fetchPrivateUploadWithRetry(fetcher, `https://i.instagram.com/rupload_igvideo/fb_uploader_${uploadId}`, {\n        method: 'POST',\n        headers: mode === 'story'\n            ? buildStoryVideoRuploadHeaders(prepared.asset, uploadId, context)\n            : buildVideoRuploadHeaders(prepared.asset, uploadId, context),\n        body: prepared.asset.bytes,\n    });\n    const videoJson = await parseJsonResponse(videoResponse, 'video upload');\n    if (String(videoJson?.status || '') !== 'ok') {\n        throw new CommandExecutionError(`Instagram private publish video upload failed for ${prepared.asset.fileName}`);\n    }\n    const coverResponse = await fetchPrivateUploadWithRetry(fetcher, `https://i.instagram.com/rupload_igphoto/fb_uploader_${uploadId}`, {\n        method: 'POST',\n        headers: buildVideoCoverRuploadHeaders(prepared.asset, uploadId, context),\n        body: prepared.asset.coverImage.bytes,\n    });\n    const coverJson = await parseJsonResponse(coverResponse, 'video cover upload');\n    if (String(coverJson?.status || '') !== 'ok') {\n        throw new CommandExecutionError(`Instagram private publish video cover upload failed for ${prepared.asset.fileName}`);\n    }\n}\nasync function publishSidecarWithRetry(input) {\n    const waitMs = input.waitMs ?? sleep;\n    const requestInit = {\n        method: 'POST',\n        headers: {\n            ...buildPrivateApiHeaders(input.apiContext),\n            'Content-Type': 'application/json',\n        },\n        body: JSON.stringify(input.payload),\n    };\n    for (let attempt = 0; attempt < INSTAGRAM_PRIVATE_SIDECAR_TRANSCODE_ATTEMPTS; attempt += 1) {\n        const response = await input.fetcher('https://www.instagram.com/api/v1/media/configure_sidecar/', requestInit);\n        const text = await response.text();\n        let json = {};\n        try {\n            json = text ? JSON.parse(text) : {};","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/_shared/private-publish.js#L815-L851","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the cover image is a valid non-empty JPEG (check file size and open it locally) before publishing","Regenerate the cover (or supply your own) and retry the publish","Retry after a short backoff if the video upload succeeded — this stage is often transiently throttled","Read the response body's message field for the specific rejection reason"],"exampleFix":"// before\nconst cover = await coverImage(videoPath); // may silently produce tiny/corrupt frame\nawait publish({ ..., coverImage: cover });\n// after\nconst cover = await coverImage(videoPath);\nif (fs.statSync(cover.cleanupPath).size < 1024) throw new Error('generated cover is corrupt; regenerate or supply one');\nawait publish({ ..., coverImage: cover });","handlingStrategy":"retry","validationCode":"const coverStat = fs.statSync(coverPath);\nif (coverStat.size < 1024) throw new Error('generated cover looks corrupt — regenerate or supply one');","typeGuard":null,"tryCatchPattern":"try { return await publish(input); }\ncatch (e) {\n  if (/video cover upload failed for/.test(e.message)) {\n    await sleep(10000);\n    return publish({ ...input, coverImage: regenerateCover(input.videoPath) }); // video already accepted\n  }\n  throw e;\n}","preventionTips":["Verify generated covers are valid non-empty JPEGs before publishing","Supply a hand-picked cover when automatic frame extraction is flaky","Back off and retry — the video upload succeeded so only the cover stage failed"],"tags":["instagram-api","upload","video-cover","http-response"],"backgroundTag":"upload-rejected","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}