{"record":{"id":"f757f9cd11ceee88","repo":"jackwener/OpenCLI","slug":"instagram-reel-share-failed","errorCode":null,"errorMessage":"Instagram reel share failed","messagePattern":"Instagram reel share failed","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/reel.js","lineNumber":612,"sourceCode":"      const failed = !shared && !sharingVisible && (\n        /couldn['’]t be shared|could not be shared|share failed|无法分享|分享失败/.test(lower)\n        || (/something went wrong/.test(lower) && /try again/.test(lower))\n      );\n      const composerOpen = dialogs.some((dialog) =>\n        !!dialog.querySelector('textarea, [contenteditable=\"true\"], input[type=\"file\"]')\n        || /new reel|cover photo|trim|select from computer|crop|sharing/.test((dialog.textContent || '').toLowerCase())\n      );\n      const settled = !shared && !composerOpen && !sharingVisible;\n      return { ok: shared, failed, settled, url: /\\\\/reel\\\\//.test(url) ? url : '' };\n    })()\n  `;\n}\nasync function waitForPublishSuccess(page) {\n    let settledStreak = 0;\n    for (let attempt = 0; attempt < 120; attempt += 1) {\n        const result = await page.evaluate(buildReelPublishStatusProbeJs());\n        if (result?.failed) {\n            throw new CommandExecutionError('Instagram reel share failed');\n        }\n        if (result?.ok) {\n            return result.url || '';\n        }\n        if (result?.settled) {\n            settledStreak += 1;\n            if (settledStreak >= 3)\n                return '';\n        }\n        else {\n            settledStreak = 0;\n        }\n        if (attempt < 119)\n            await page.wait({ time: 1 });\n    }\n    throw new CommandExecutionError('Instagram reel share confirmation did not appear');\n}\nasync function resolveProfileUrl(page, currentUserId = '') {","sourceCodeStart":594,"sourceCodeEnd":630,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/reel.js#L594-L630","documentation":"waitForPublishSuccess evaluates buildReelPublishStatusProbeJs() up to 120 times (1s apart) while Instagram processes the share. The probe inspects the dialog/UI for a failure state; if result.failed is truthy, the library throws this error immediately instead of waiting out the full timeout.","triggerScenarios":"Instagram itself reports the upload/share as failed inside the dialog (error banner, 'Couldn't post' state) during the 120-second post-share wait; waitForPublishSuccess detects it on the next probe and throws.","commonSituations":"Video file violates Instagram encoding/duration/size constraints, duplicate-content or rate-limit rejection, account restrictions (action block, unverified account), network drop mid-upload, or Instagram returning a server error during processing.","solutions":["Check the video file meets Instagram reel requirements (format, duration, aspect ratio, size) and re-encode if needed (e.g. H.264 MP4).","Wait before retrying — rate limits and temporary action blocks clear with time; reduce share frequency.","Check account standing in the Instagram app; resolve any 'try again later' notices, verify email/phone, or appeal restrictions.","Retry with a stable network connection; transient upload failures often succeed on a second attempt.","Inspect the Instagram app/web UI for the exact rejection message, since this error only signals the generic failed state detected by the probe."],"exampleFix":"// before\nawait ffmpeg(input).outputOptions(['-c:v libx264','-b:v 8000k']).output(reelPath).run(); // 4K, 90s\n// after\nawait ffmpeg(input).outputOptions(['-c:v libx264','-vf scale=1080:1920','-r 30','-b:v 5000k']).output(reelPath).run(); // compliant 1080x1920 MP4","handlingStrategy":"try-catch","validationCode":"// validate the video against reel constraints before invoking the share\nimport { statSync } from 'node:fs';\nconst { size } = statSync(videoPath);\nconst extOk = /\\.(mp4|mov)$/i.test(videoPath);\nif (!extOk || size > 4 * 1024 * 1024 * 1024) {\n  throw new Error('Video must be mp4/mov and within Instagram size limits');\n}","typeGuard":"null","tryCatchPattern":"try {\n  await client.shareReel({ videoPath, caption });\n} catch (err) {\n  if (String(err.message).includes('reel share failed')) {\n    // inspect account/rate-limit state, back off, optionally re-encode, then retry later\n    await backoff(() => client.shareReel({ videoPath, caption }));\n  } else throw err;\n}","preventionTips":["Pre-encode videos to Instagram specs (H.264 MP4, 1080x1920, sane bitrate/duration)","Respect rate limits; space out publishes to avoid action blocks","Keep the account in good standing (verified contact info, no automation abuse)","Use a stable network connection during shares"],"tags":["instagram","upload-failed","rate-limit","automation"],"backgroundTag":"upload-rejected","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}