jackwener/OpenCLI · error · CommandExecutionError

Instagram reel upload requires Browser Bridge file upload su

Error message

Instagram reel upload requires Browser Bridge file upload support

What it means

uploadVideo requires the page object to expose setFileInput for programmatically attaching files to a file input. If page.setFileInput is undefined it throws CommandExecutionError saying reel upload requires Browser Bridge file upload support. Without this capability the library cannot put the local file into Instagram's upload input.

Source

Thrown at clis/instagram/reel.js:190

          const accept = (input.getAttribute('accept') || '').toLowerCase();
          if (accept && !accept.includes('video') && !accept.includes('.mp4')) continue;
          input.setAttribute('data-opencli-reel-upload-index', String(index));
          selectors.push('[data-opencli-reel-upload-index="' + index + '"]');
          index += 1;
        }
      }

      return { ok: selectors.length > 0, selectors };
    })()
  `);
    if (!result?.ok || !Array.isArray(result.selectors) || result.selectors.length === 0) {
        throw new CommandExecutionError('Instagram reel upload input not found', 'Open the new-post composer in a logged-in browser session and retry');
    }
    return result.selectors;
}
async function uploadVideo(page, videoPath, selector) {
    if (!page.setFileInput) {
        throw new CommandExecutionError('Instagram reel upload requires Browser Bridge file upload support', 'Use Browser Bridge or another browser mode that supports setFileInput');
    }
    await page.setFileInput([videoPath], selector);
}
async function readSelectedFileCount(page, selector) {
    const result = await page.evaluate(`
    (() => {
      const input = document.querySelector(${JSON.stringify(selector)});
      if (!(input instanceof HTMLInputElement)) return { count: null };
      return { count: input.files?.length || 0 };
    })()
  `);
    if (result?.count === null || result?.count === undefined)
        return null;
    return Number(result.count);
}
async function waitForVideoPreview(page, maxWaitSeconds = 20) {
    let lastDetail = '';
    for (let attempt = 0; attempt < maxWaitSeconds * 2; attempt += 1) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run the command with Browser Bridge (or another mode supporting setFileInput) as the browser backend.
  2. Upgrade Browser Bridge/driver to a version exposing setFileInput.
  3. Implement setFileInput on a custom page adapter to delegate to the underlying driver's file-upload API.
  4. Verify the active browser mode before posting (feature-check page.setFileInput).

Example fix

// before
const page = await connectBasicDriver(); // no setFileInput
await runReel(page);
// after
const page = await connectBrowserBridge(); // supports setFileInput
await runReel(page);
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof page.setFileInput !== 'function') throw new Error('Current browser mode lacks setFileInput; use Browser Bridge');

Type guard

function supportsFileUpload(page) { return typeof page?.setFileInput === 'function'; }

Try / catch

try { await reel(args); } catch (e) { if (e.message.includes('setFileInput')) { console.error('Switch to Browser Bridge: e.g. set browser mode to browser-bridge and reconnect.'); return; } throw e; }

Prevention

When it happens

Trigger: Running the reel flow with a browser mode that lacks setFileInput — plain automation pages, older Browser Bridge versions, or drivers that only expose evaluate/wait but not file upload.

Common situations: Using a legacy browser driver, Browser Bridge not upgraded to the version adding setFileInput, or a custom page adapter that doesn't implement the method.

Related errors


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