{"record":{"id":"f27204c1282fe955","repo":"jackwener/OpenCLI","slug":"instagram-mixed-media-posting-requires-browser-bri","errorCode":null,"errorMessage":"Instagram mixed-media posting requires Browser Bridge file upload support","messagePattern":"Instagram mixed-media posting requires Browser Bridge file upload support","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/post.js","lineNumber":637,"sourceCode":"        try {\n            await page.setFileInput(mediaPaths, activeSelector);\n            await dispatchUploadEvents(page, activeSelector);\n            return;\n        }\n        catch (error) {\n            const message = error instanceof Error ? error.message : String(error);\n            const staleSelector = message.includes('No element found matching selector')\n                || message.includes('Could not find node with given id')\n                || message.includes('No node with given id found');\n            if (staleSelector && attempt === 0) {\n                activeSelector = await resolveFreshUploadSelector(page, activeSelector, mediaItems);\n                continue;\n            }\n            if (!message.includes('Unknown action') && !message.includes('set-file-input') && !message.includes('not supported')) {\n                throw error;\n            }\n            if (mediaItems.some((item) => item.type === 'video')) {\n                throw new CommandExecutionError('Instagram mixed-media posting requires Browser Bridge file upload support', 'Use Browser Bridge or another browser mode that supports setFileInput for image/video uploads');\n            }\n            await injectImageViaBrowser(page, mediaPaths, activeSelector);\n            return;\n        }\n    }\n}\nfunction describePostDetail(mediaItems) {\n    if (mediaItems.every((item) => item.type === 'image')) {\n        return mediaItems.length === 1\n            ? 'Single image post shared successfully'\n            : `${mediaItems.length}-image carousel post shared successfully`;\n    }\n    return mediaItems.length === 1\n        ? 'Single mixed-media post shared successfully'\n        : `${mediaItems.length}-item mixed-media carousel post shared successfully`;\n}\nfunction getCommandAttemptBudget(mediaItems) {\n    if (mediaItems.length >= 10)","sourceCodeStart":619,"sourceCodeEnd":655,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/post.js#L619-L655","documentation":"During uploadMedia's retry loop, if setFileInput fails with an 'Unknown action' / 'set-file-input' / 'not supported' error, the library checks whether any media item is a video. Mixed image+video batches cannot use the image-only browser-injection fallback, so it throws this variant to say the driver must natively support setFileInput for media uploads.","triggerScenarios":"Posting a media set containing at least one video while page.setFileInput either does not exist or rejects the call with 'Unknown action', 'set-file-input', or 'not supported'; the code path reaches the mediaItems.some(type === 'video') branch and throws.","commonSituations":"Carousel posts combining photos and a video in a non-Browser-Bridge mode, driver versions that only support image file injection, or remote browsers blocking the set-file-input action.","solutions":["Use Browser Bridge mode which supports setFileInput for image and video uploads","Post the images via the fallback path and upload the video separately if the driver cannot handle mixed media","Upgrade the browser driver to one with full setFileInput support","Retry with an image-only batch to confirm the driver's capability boundary"],"exampleFix":"// before\nawait postMedia(page, ['a.jpg', 'b.mp4']); // mixed batch on unsupported driver\n// after\nif (!page.setFileInput) {\n  await postMedia(page, ['a.jpg']); // image-only can use browser injection\n  await postMedia(page, ['b.mp4']); // video posted separately via supported mode\n} else {\n  await postMedia(page, ['a.jpg', 'b.mp4']);\n}","handlingStrategy":"validation","validationCode":"const hasVideo = mediaItems.some(i => i.type === 'video');\nif (hasVideo && typeof page.setFileInput !== 'function') {\n  throw new Error('Video posts require Browser Bridge setFileInput support');\n}","typeGuard":"function canUploadMixedMedia(page, items) {\n  return !items.some(i => i.type === 'video') || typeof page.setFileInput === 'function';\n}","tryCatchPattern":"try {\n  await uploadMedia(page, mediaItems, selector);\n} catch (e) {\n  if (String(e.message).includes('mixed-media posting requires')) {\n    // split: images via fallback, video via supported path\n    await uploadMedia(page, mediaItems.filter(i => i.type !== 'video'), selector);\n    await uploadVideoViaApi(mediaItems.find(i => i.type === 'video'));\n  } else throw e;\n}","preventionTips":["Validate capability per media type before composing the batch","Route video uploads through modes known to support them","Keep mixed carousels out of drivers with image-only file injection"],"tags":["instagram","browser-bridge","video-upload","api-capability"],"backgroundTag":"api-not-supported","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}