jackwener/OpenCLI · error · CommandExecutionError

Instagram reel share failed

Error message

Instagram reel share failed

What it means

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.

Source

Thrown at clis/instagram/reel.js:612

      const failed = !shared && !sharingVisible && (
        /couldn['’]t be shared|could not be shared|share failed|无法分享|分享失败/.test(lower)
        || (/something went wrong/.test(lower) && /try again/.test(lower))
      );
      const composerOpen = dialogs.some((dialog) =>
        !!dialog.querySelector('textarea, [contenteditable="true"], input[type="file"]')
        || /new reel|cover photo|trim|select from computer|crop|sharing/.test((dialog.textContent || '').toLowerCase())
      );
      const settled = !shared && !composerOpen && !sharingVisible;
      return { ok: shared, failed, settled, url: /\\/reel\\//.test(url) ? url : '' };
    })()
  `;
}
async function waitForPublishSuccess(page) {
    let settledStreak = 0;
    for (let attempt = 0; attempt < 120; attempt += 1) {
        const result = await page.evaluate(buildReelPublishStatusProbeJs());
        if (result?.failed) {
            throw new CommandExecutionError('Instagram reel share failed');
        }
        if (result?.ok) {
            return result.url || '';
        }
        if (result?.settled) {
            settledStreak += 1;
            if (settledStreak >= 3)
                return '';
        }
        else {
            settledStreak = 0;
        }
        if (attempt < 119)
            await page.wait({ time: 1 });
    }
    throw new CommandExecutionError('Instagram reel share confirmation did not appear');
}
async function resolveProfileUrl(page, currentUserId = '') {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Check the video file meets Instagram reel requirements (format, duration, aspect ratio, size) and re-encode if needed (e.g. H.264 MP4).
  2. Wait before retrying — rate limits and temporary action blocks clear with time; reduce share frequency.
  3. Check account standing in the Instagram app; resolve any 'try again later' notices, verify email/phone, or appeal restrictions.
  4. Retry with a stable network connection; transient upload failures often succeed on a second attempt.
  5. Inspect the Instagram app/web UI for the exact rejection message, since this error only signals the generic failed state detected by the probe.

Example fix

// before
await ffmpeg(input).outputOptions(['-c:v libx264','-b:v 8000k']).output(reelPath).run(); // 4K, 90s
// after
await ffmpeg(input).outputOptions(['-c:v libx264','-vf scale=1080:1920','-r 30','-b:v 5000k']).output(reelPath).run(); // compliant 1080x1920 MP4
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the video against reel constraints before invoking the share
import { statSync } from 'node:fs';
const { size } = statSync(videoPath);
const extOk = /\.(mp4|mov)$/i.test(videoPath);
if (!extOk || size > 4 * 1024 * 1024 * 1024) {
  throw new Error('Video must be mp4/mov and within Instagram size limits');
}

Type guard

null

Try / catch

try {
  await client.shareReel({ videoPath, caption });
} catch (err) {
  if (String(err.message).includes('reel share failed')) {
    // inspect account/rate-limit state, back off, optionally re-encode, then retry later
    await backoff(() => client.shareReel({ videoPath, caption }));
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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