jackwener/OpenCLI · error · CommandExecutionError

Browser extension does not support file upload. Please updat

Error message

Browser extension does not support file upload. Please update the extension.

What it means

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.

Source

Thrown at clis/weibo/publish.js:162

                    }
                    if (!last) return { found: false };
                    return { found: true, visible: true, rectTop: last.getBoundingClientRect().top };
                })(${JSON.stringify(TEXTAREA_SELECTORS)})
            `);
            if (result?.found && result.visible && result.rectTop >= 0) {
                editorFound = true;
                break;
            }
            await page.wait({ time: COMPOSE_POLL_MS / 1000 });
        }
        if (!editorFound) {
            throw new CommandExecutionError('Weibo compose editor did not appear');
        }

        // Step 5: Upload images first (before text to avoid editor reset)
        if (absPaths.length > 0) {
            if (!page.setFileInput) {
                throw new CommandExecutionError('Browser extension does not support file upload. Please update the extension.');
            }

            // Find the file input
            const fileInputFound = await page.evaluate(`
                () => {
                    const input = document.querySelector('input[type="file"][class*="_file_"]');
                    return !!input;
                }
            `);
            if (!fileInputFound) {
                throw new CommandExecutionError('Could not find image file input on Weibo compose page. UI may have changed.');
            }

            await page.setFileInput(absPaths, FILE_INPUT_SELECTOR);

            // Wait for upload to complete
            let uploadResult = null;
            for (let i = 0; i < Math.ceil(UPLOAD_TIMEOUT_MS / UPLOAD_POLL_MS); i++) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Update the browser extension to the latest version, then reload the browser
  2. Verify the extension version matches the CLI version requirements (run the CLI's doctor/status command if available)
  3. As a workaround, publish text-only (omit --images) or attach images manually in the opened browser tab

Example fix

// before (old extension, no API)
await page.setFileInput(paths, 'input[type="file"]'); // TypeError: page.setFileInput is not a function
// after
if (typeof page.setFileInput !== 'function') {
    throw new CommandExecutionError('Browser extension does not support file upload. Please update the extension.');
}
await page.setFileInput(paths, 'input[type="file"]');
Defensive patterns

Strategy: validation

Validate before calling

if (typeof page.setFileInput !== 'function') {
    console.error('Your browser extension lacks file-upload support. Update the extension before using --images.');
    process.exit(1);
}

Type guard

function supportsFileUpload(page) {
    return typeof page === 'object' && page !== null && typeof page.setFileInput === 'function';
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/eff51a4606d43c81. Report an issue: GitHub.