{"record":{"id":"6b2108e8b1289941","repo":"jackwener/OpenCLI","slug":"instagram-reel-upload-requires-browser-bridge-file","errorCode":null,"errorMessage":"Instagram reel upload requires Browser Bridge file upload support","messagePattern":"Instagram reel upload requires Browser Bridge file upload support","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/reel.js","lineNumber":190,"sourceCode":"          const accept = (input.getAttribute('accept') || '').toLowerCase();\n          if (accept && !accept.includes('video') && !accept.includes('.mp4')) continue;\n          input.setAttribute('data-opencli-reel-upload-index', String(index));\n          selectors.push('[data-opencli-reel-upload-index=\"' + index + '\"]');\n          index += 1;\n        }\n      }\n\n      return { ok: selectors.length > 0, selectors };\n    })()\n  `);\n    if (!result?.ok || !Array.isArray(result.selectors) || result.selectors.length === 0) {\n        throw new CommandExecutionError('Instagram reel upload input not found', 'Open the new-post composer in a logged-in browser session and retry');\n    }\n    return result.selectors;\n}\nasync function uploadVideo(page, videoPath, selector) {\n    if (!page.setFileInput) {\n        throw new CommandExecutionError('Instagram reel upload requires Browser Bridge file upload support', 'Use Browser Bridge or another browser mode that supports setFileInput');\n    }\n    await page.setFileInput([videoPath], selector);\n}\nasync function readSelectedFileCount(page, selector) {\n    const result = await page.evaluate(`\n    (() => {\n      const input = document.querySelector(${JSON.stringify(selector)});\n      if (!(input instanceof HTMLInputElement)) return { count: null };\n      return { count: input.files?.length || 0 };\n    })()\n  `);\n    if (result?.count === null || result?.count === undefined)\n        return null;\n    return Number(result.count);\n}\nasync function waitForVideoPreview(page, maxWaitSeconds = 20) {\n    let lastDetail = '';\n    for (let attempt = 0; attempt < maxWaitSeconds * 2; attempt += 1) {","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/reel.js#L172-L208","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the command with Browser Bridge (or another mode supporting setFileInput) as the browser backend.","Upgrade Browser Bridge/driver to a version exposing setFileInput.","Implement setFileInput on a custom page adapter to delegate to the underlying driver's file-upload API.","Verify the active browser mode before posting (feature-check page.setFileInput)."],"exampleFix":"// before\nconst page = await connectBasicDriver(); // no setFileInput\nawait runReel(page);\n// after\nconst page = await connectBrowserBridge(); // supports setFileInput\nawait runReel(page);","handlingStrategy":"type-guard","validationCode":"if (typeof page.setFileInput !== 'function') throw new Error('Current browser mode lacks setFileInput; use Browser Bridge');","typeGuard":"function supportsFileUpload(page) { return typeof page?.setFileInput === 'function'; }","tryCatchPattern":"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; }","preventionTips":["Feature-check page.setFileInput before running upload flows","Use Browser Bridge as the browser backend for posting flows","Keep Browser Bridge upgraded to the latest version","Implement setFileInput on custom page adapters"],"tags":["capability-missing","browser-bridge","file-upload"],"backgroundTag":"unsupported-browser-capability","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}