jackwener/OpenCLI · error
setFileInput returned no count — command may not be supporte
Error message
setFileInput returned no count — command may not be supported by the extension
What it means
setFileInput sends the 'set-file-input' command through the Chrome extension bridge and expects a result containing a numeric count of matched inputs. If the count is missing or 0, it assumes the connected extension does not implement the command and throws.
Source
Thrown at src/browser/page.ts:316
timeoutMs,
...this._cmdOpts(),
});
return result as BrowserDownloadWaitResult;
}
/**
* Set local file paths on a file input element via CDP DOM.setFileInputFiles.
* Chrome reads the files directly from the local filesystem, avoiding the
* payload size limits of base64-in-evaluate.
*/
async setFileInput(files: string[], selector?: string): Promise<void> {
const result = await sendCommand('set-file-input', {
files,
selector,
...this._cmdOpts(),
}) as { count?: number };
if (!result?.count) {
throw new Error('setFileInput returned no count — command may not be supported by the extension');
}
}
async insertText(text: string): Promise<void> {
const result = await sendCommand('insert-text', {
text,
...this._cmdOpts(),
}) as { inserted?: boolean };
if (!result?.inserted) {
throw new Error('insertText returned no inserted flag — command may not be supported by the extension');
}
}
async frames(): Promise<Array<{ index: number; frameId: string; url: string; name: string }>> {
const result = await sendCommand('frames', { ...this._cmdOpts() });
return Array.isArray(result) ? result : [];
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Update the OpenCLI Chrome extension to the latest version and reload it in chrome://extensions
- Check that the selector matches at least one file input element on the page
- Fall back to CDP DOM.setFileInputFiles as an alternative path
Example fix
// before
await page.setFileInput('/tmp/upload.png', 'input[type=file]');
// after: guard against unsupported extension
const inputs = await page.evaluate("document.querySelectorAll('input[type=file]').length");
if (inputs > 0) await page.setFileInput('/tmp/upload.png', 'input[type=file]'); Defensive patterns
Strategy: fallback
Validate before calling
const inputCount = await page.evaluate("document.querySelectorAll('input[type=file]').length");
if (inputCount === 0) throw new Error('no file inputs match'); Type guard
function supportsSetFileInput(r: { count?: number } | null): r is { count: number } {
return typeof r?.count === 'number' && r.count > 0;
} Try / catch
try { await page.setFileInput(files, sel); }
catch (e) {
if (String(e.message).includes('no count')) {
// fallback: CDP DOM.setFileInputFiles
} else throw e;
} Prevention
- Keep the Chrome extension version in sync with the CLI
- Verify the selector matches a file input before calling
- Reload the extension after CLI upgrades
When it happens
Trigger: Calling page.setFileInput(files, selector) when the extension responds with a result lacking a truthy count — either an older extension version without set-file-input support, or the selector matching no inputs.
Common situations: Extension not updated after OpenCLI upgrade added set-file-input; selector matches zero file inputs on the page; result shape changed between extension versions.
Related errors
- insertText returned no inserted flag — command may not be su
- Unexpected 12306 probe: ${JSON.stringify(probe)}
- Waiting for 12306 tk auth cookie
- amazon.com
- Unexpected Amazon probe: ${JSON.stringify(probe)}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/093ffda055abee73.
Report an issue: GitHub.