Repository navigation
Description
Description of the bug
upload_file with two paths on an <input type=file> that lacks multiple fails with Failed to upload file. The element could not accept the file directly, and clicking it did not trigger a file chooser. Both halves of that message are wrong for this input: the input accepts files directly (a single path uploads fine), and the call's timing shows that clicking it did trigger a file chooser. The actual cause, that the input accepts only one file, is discarded. As a side effect the tool clicked the input, which the page observed. An agent reading the message looks for a different upload element instead of passing one file. Both tested builds behave the same.
Actual behavior
Identical on both builds:
upload_file [a.txt, b.txt] isError=true 53-58 ms
Error: Failed to upload file. The element could not accept the file directly, and clicking it did not trigger a file chooser.
evaluate_script -> {"log":["input clicked"],"files":[]}
upload_file [a.txt] isError=false "File uploaded from <workspace>/up/a.txt."
evaluate_script -> {"log":["input clicked","change 1"],"files":["a.txt"]}
The page recorded the click on the input. The failure arrived after 53-58 ms, far less than the fallback's 3000 ms file-chooser wait, which (with the source path below) indicates that the chooser did open and the failure came from accepting it; this is inferred from timing and source, not observed directly.
Reproduction
-
Create
<workspace>/up/a.txtand<workspace>/up/b.txt(any small text files) and start the server under test with the flags above plus--workspace <workspace>. -
Serve this page as
/uploadone.html:
<!doctype html><title>Upload one</title>
<label>Attachment <input id="f" type="file"></label>
<script>window.log = []; f.addEventListener('click', () => log.push('input clicked')); f.addEventListener('change', () => log.push('change ' + f.files.length)); f.addEventListener('cancel', () => log.push('cancel'));</script>- Send these calls in order (
take_snapshotreturneduid=1_2 button "Attachment"for the input):
{"name":"navigate_page","arguments":{"pageId":1,"url":"http://127.0.0.1:PORT/uploadone.html"}}
{"name":"take_snapshot","arguments":{"pageId":1}}
{"name":"upload_file","arguments":{"pageId":1,"uid":"1_2","filePaths":["<workspace>/up/a.txt","<workspace>/up/b.txt"]}}
{"name":"evaluate_script","arguments":{"pageId":1,"function":"() => ({log: window.log, files: [...document.getElementById('f').files].map(x => x.name)})"}}
{"name":"upload_file","arguments":{"pageId":1,"uid":"1_2","filePaths":["<workspace>/up/a.txt"]}}
{"name":"evaluate_script","arguments":{"pageId":1,"function":"() => ({log: window.log, files: [...document.getElementById('f').files].map(x => x.name)})"}}The single-path upload is a control. Ran once per build for this report, plus one earlier run per build on a similar page with the same error.
Expectation
filePaths accepts "One or more files paths to upload." (src/tools/input.ts:557-562 at the main commit; docs/tool-reference.md). When the target input accepts only one file, the call cannot succeed, and its error should state that cause (the input does not accept multiple files) so the agent can retry with one path. The fallback message is meant for elements that are neither a file input nor a chooser-opening element; it should not be reported when the element is a file input and a chooser did open.
MCP configuration
--headless --isolated --no-usage-statistics --no-performance-crux unless the reproduction states otherwise (update checks disabled with CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1).
Chrome DevTools MCP version
1.10.1 (npm) and main 5ddb0a3 (local build)
Chrome version
154.0.8037.98 (stable)
Node version
v22.23.2
Operating system
macOS 27.0
Environment details
- chrome-devtools-mcp 1.10.1 from npm (the release build).
- chrome-devtools-mcp built from
mainat commit 5ddb0a3 (themainbuild; its server info still reports version 1.10.1). - Google Chrome 154.0.8037.98 stable, headless; Node v22.23.2; macOS 27.
- Both builds were started with
--headless --isolated --no-usage-statistics --no-performance-cruxandCHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1, and driven by a scripted stdio MCP client that sends onetools/callat a time and recordsisErrorand wall time. Fixtures were served from a loopback HTTP server on an ephemeral port (PORTbelow); any static server, such aspython3 -m http.server --bind 127.0.0.1, serves the static fixtures the same way.
Evidence
- Expected source:
filePathsdescription and the fallback error text insrc/tools/input.ts:555-601at themaincommit. - Failure source: scripted MCP run above on both builds, with the page's event log. Static breadcrumb: Puppeteer's
ElementHandle.uploadFileassertsMultiple file uploads only work with <input type=file multiple>; the tool's first barecatch {}(src/tools/input.ts:582) discards that error and clicks the element to wait for a chooser, andfileChooser.acceptthen throws the same assertion, which the second barecatch {}(src/tools/input.ts:592) replaces with the generic message. - Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
Fix check
With the steps above, the two-path upload_file returns isError: true with a message that the input does not accept multiple files (or equivalent), and does not claim that no file chooser was triggered. Controls that must keep passing: the single-path upload still succeeds, and upload_file on an element that neither is a file input nor opens a chooser (for example a plain <button>) still fails with the existing fallback message (reported by an earlier run in this investigation on both builds: the tool clicked the button and failed after about 3 s; not rerun for this report).
Additional context
The full open and closed issue and PR corpus was screened as of 2026-10-06 (searches included upload_file, multiple file upload); no issue reports this. #2310 (tab crash when uploading through a chooser-opening element) is a different failure.
Activity
fix(input): reject multiple file paths on single-file input in upload…
chore(main): release chrome-devtools-mcp 1.11.0 (#2823)
test(input): assert the single-file input check skips the file chooser
fix(input): allow multi-file upload_file through chooser-opening elem…