{"record":{"id":"fdeb7425992cd799","repo":"jackwener/OpenCLI","slug":"instagram-reel-upload-input-not-found","errorCode":null,"errorMessage":"Instagram reel upload input not found","messagePattern":"Instagram reel upload input not found","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/instagram/reel.js","lineNumber":101,"sourceCode":"            && style.visibility !== 'hidden'\n            && rect.width > 0\n            && rect.height > 0;\n        };\n        const inputs = Array.from(document.querySelectorAll('input[type=\"file\"]'))\n          .filter((el) => el instanceof HTMLInputElement)\n          .filter((el) => {\n            const dialog = el.closest('[role=\"dialog\"]');\n            return dialog instanceof HTMLElement && isVisible(dialog);\n          });\n        return { ok: inputs.length > 0 };\n      })()\n    `);\n        if (ready?.ok)\n            return;\n        if (attempt < 11)\n            await page.wait({ time: 0.5 });\n    }\n    throw new CommandExecutionError('Instagram reel upload input not found', 'Open the new-post composer in a logged-in browser session and retry');\n}\nasync function dismissResidualDialogs(page) {\n    for (let attempt = 0; attempt < 4; attempt += 1) {\n        const result = await page.evaluate(`\n      (() => {\n        const isVisible = (el) => {\n          if (!(el instanceof HTMLElement)) return false;\n          const style = window.getComputedStyle(el);\n          const rect = el.getBoundingClientRect();\n          return style.display !== 'none'\n            && style.visibility !== 'hidden'\n            && rect.width > 0\n            && rect.height > 0;\n        };\n\n        const dialogs = Array.from(document.querySelectorAll('[role=\"dialog\"]'))\n          .filter((el) => el instanceof HTMLElement && isVisible(el));\n        for (const dialog of dialogs) {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/reel.js#L83-L119","documentation":"After opening the composer, ensureComposerOpen polls up to 12 times (0.5s apart, ~6s) for the file-upload input to become visible; if it never appears it throws CommandExecutionError 'Instagram reel upload input not found' with a hint to use a logged-in session with the new-post composer open. It indicates the composer opened but the expected upload input never rendered.","triggerScenarios":"Composer opened but the file input selector never matched within ~6 seconds — slow page load, Instagram served a different composer variant, input hidden behind a dialog/overlay, or composer markup changed.","commonSituations":"Slow network/machine exceeding the ~6s poll window, residual modal dialogs blocking the composer, Instagram A/B UI differences, or the account shown a 'create' flow variant without the expected input.","solutions":["Retry when the network/machine is faster; ensure the composer fully renders before the flow runs.","Confirm manually that the logged-in session shows the new-post composer with a file input.","Dismiss any overlapping dialogs (the flow's dismissResidualDialogs may have missed a new variant).","Update selectors in the library if Instagram changed the upload input markup."],"exampleFix":"// before\nawait ensureComposerOpen(page); // 12 x 0.5s may be too short on slow loads\n// after\nawait gotoInstagramHome(page);\nawait page.wait({ time: 3 }); // let SPA finish hydrating\nawait ensureComposerOpen(page);","handlingStrategy":"retry","validationCode":"await ensureComposerOpen(page);\nawait page.wait({ time: 2 }); // give the composer SPA time to render the input","typeGuard":null,"tryCatchPattern":"try { await reel(args); } catch (e) { if (e.message.includes('upload input not found')) { await page.wait({ time: 3 }); return reel(args); } throw e; }","preventionTips":["Run on a machine/network fast enough to render the composer within seconds","Dismiss residual dialogs before opening the composer","Retry once on transient failures","Update selectors if Instagram changes composer markup"],"tags":["dom-automation","timeout","instagram"],"backgroundTag":"element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}