jackwener/OpenCLI · error · CommandExecutionError
Instagram posting requires Browser Bridge file upload suppor
Error message
Instagram posting requires Browser Bridge file upload support
What it means
uploadMedia requires page.setFileInput to attach media files to the composer's file input. When the connected browser driver does not implement setFileInput, the library throws immediately with this message instead of attempting a doomed upload. It is an environment-capability check, not a page-state failure.
Source
Thrown at clis/instagram/post.js:615
return { state: 'pending', detail: dialogText || '' };
})()
`;
}
async function inspectUploadStage(page) {
const result = await page.evaluate(buildInspectUploadStageJs());
if (result?.state)
return result;
if (result?.ok === true)
return { state: 'preview', detail: result.detail };
return { state: 'pending', detail: result?.detail };
}
function makeUploadFailure(detail) {
return new CommandExecutionError('Instagram image upload failed', detail ? `Instagram rejected the upload: ${detail}` : 'Instagram rejected the upload before the preview stage');
}
async function uploadMedia(page, mediaItems, selector) {
const mediaPaths = mediaItems.map((item) => item.filePath);
if (!page.setFileInput) {
throw new CommandExecutionError('Instagram posting requires Browser Bridge file upload support', 'Use Browser Bridge or another browser mode that supports setFileInput');
}
let activeSelector = selector;
for (let attempt = 0; attempt < 2; attempt++) {
try {
await page.setFileInput(mediaPaths, activeSelector);
await dispatchUploadEvents(page, activeSelector);
return;
}
catch (error) {
const message = error instanceof Error ? error.message : String(error);
const staleSelector = message.includes('No element found matching selector')
|| message.includes('Could not find node with given id')
|| message.includes('No node with given id found');
if (staleSelector && attempt === 0) {
activeSelector = await resolveFreshUploadSelector(page, activeSelector, mediaItems);
continue;
}
if (!message.includes('Unknown action') && !message.includes('set-file-input') && !message.includes('not supported')) {View on GitHub (pinned to 49907e53dc)
Solutions
- Switch to Browser Bridge mode so the page object exposes setFileInput
- Update the browser driver/CLI to a version that implements setFileInput
- Confirm the active browser mode with the CLI's mode/diagnostics command before posting
Example fix
// before const page = await plainPuppeteerLaunch(); await postImage(page, 'photo.jpg'); // after const page = await launchBrowserBridge(); // provides page.setFileInput await postImage(page, 'photo.jpg');
Defensive patterns
Strategy: validation
Validate before calling
if (typeof page.setFileInput !== 'function') {
throw new Error('Current browser mode lacks setFileInput; enable Browser Bridge before posting');
} Type guard
function supportsFileUpload(page) { return typeof page.setFileInput === 'function'; } Try / catch
try {
await postImage(page, file);
} catch (e) {
if (String(e.message).includes('Browser Bridge file upload support')) {
console.error('Relaunch the CLI in Browser Bridge mode and retry.');
process.exitCode = 2;
} else throw e;
} Prevention
- Check page.setFileInput existence at startup and fail fast with a clear message
- Pin the CLI/driver version that provides setFileInput in your environment
- Document the required browser mode in your posting wrapper
When it happens
Trigger: Calling executeUiInstagramPost with a page object whose prototype lacks setFileInput — e.g. a plain Puppeteer/Playwright page or a driver mode other than Browser Bridge.
Common situations: Launching the CLI in a headless/CDP mode that skips Browser Bridge, using an older driver version predating setFileInput, or pointing the tool at a remote browser that does not expose the extension.
Related errors
- Instagram mixed-media posting requires Browser Bridge file u
- Browser Bridge does not support Reference drag-and-drop
- Gmail ${label} returned a malformed Browser Bridge envelope
- Gmail ${operation} response exceeded the browser capture lim
- Gmail ${operation} response body was unavailable
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d5abc5010477cdd0.
Report an issue: GitHub.