{"record":{"id":"eff51a4606d43c81","repo":"jackwener/OpenCLI","slug":"browser-extension-does-not-support-file-upload-pl","errorCode":null,"errorMessage":"Browser extension does not support file upload. Please update the extension.","messagePattern":"Browser extension does not support file upload\\. Please update the extension\\.","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/weibo/publish.js","lineNumber":162,"sourceCode":"                    }\n                    if (!last) return { found: false };\n                    return { found: true, visible: true, rectTop: last.getBoundingClientRect().top };\n                })(${JSON.stringify(TEXTAREA_SELECTORS)})\n            `);\n            if (result?.found && result.visible && result.rectTop >= 0) {\n                editorFound = true;\n                break;\n            }\n            await page.wait({ time: COMPOSE_POLL_MS / 1000 });\n        }\n        if (!editorFound) {\n            throw new CommandExecutionError('Weibo compose editor did not appear');\n        }\n\n        // Step 5: Upload images first (before text to avoid editor reset)\n        if (absPaths.length > 0) {\n            if (!page.setFileInput) {\n                throw new CommandExecutionError('Browser extension does not support file upload. Please update the extension.');\n            }\n\n            // Find the file input\n            const fileInputFound = await page.evaluate(`\n                () => {\n                    const input = document.querySelector('input[type=\"file\"][class*=\"_file_\"]');\n                    return !!input;\n                }\n            `);\n            if (!fileInputFound) {\n                throw new CommandExecutionError('Could not find image file input on Weibo compose page. UI may have changed.');\n            }\n\n            await page.setFileInput(absPaths, FILE_INPUT_SELECTOR);\n\n            // Wait for upload to complete\n            let uploadResult = null;\n            for (let i = 0; i < Math.ceil(UPLOAD_TIMEOUT_MS / UPLOAD_POLL_MS); i++) {","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weibo/publish.js#L144-L180","documentation":"This CommandExecutionError is thrown when the weibo publish command needs to upload images but the connected browser extension's page API lacks the setFileInput method. The extension is the bridge that lets the CLI drive file inputs in the live weibo.com tab; older extension builds simply do not expose that capability, so the command aborts before touching the DOM rather than failing mid-upload.","triggerScenarios":"Running `weibo publish \"text\" --images a.jpg` (absPaths.length > 0) with an outdated browser extension installed — the page object passed to func has no setFileInput function.","commonSituations":"Users installed the opencli Chrome extension once and never updated it after an upgrade that added file-upload support; corporate-managed browsers pinning an old extension version; running the CLI against a browser profile whose extension was sideloaded from an old source.","solutions":["Update the browser extension to the latest version, then reload the browser","Verify the extension version matches the CLI version requirements (run the CLI's doctor/status command if available)","As a workaround, publish text-only (omit --images) or attach images manually in the opened browser tab"],"exampleFix":"// before (old extension, no API)\nawait page.setFileInput(paths, 'input[type=\"file\"]'); // TypeError: page.setFileInput is not a function\n// after\nif (typeof page.setFileInput !== 'function') {\n    throw new CommandExecutionError('Browser extension does not support file upload. Please update the extension.');\n}\nawait page.setFileInput(paths, 'input[type=\"file\"]');","handlingStrategy":"validation","validationCode":"if (typeof page.setFileInput !== 'function') {\n    console.error('Your browser extension lacks file-upload support. Update the extension before using --images.');\n    process.exit(1);\n}","typeGuard":"function supportsFileUpload(page) {\n    return typeof page === 'object' && page !== null && typeof page.setFileInput === 'function';\n}","tryCatchPattern":null,"preventionTips":["Keep the browser extension auto-updated (enable developer-mode auto-update or reinstall from the latest source)","Before adding --images to automations, assert the extension version supports setFileInput","Pin the extension version in CI and bump it together with the CLI"],"tags":["browser-extension","file-upload","outdated-version"],"backgroundTag":"browser-extension-outdated","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}