[BUG]file_upload (Claude in Chrome) always fails with 'expected array, received undefined
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
What Should Happen?
claude should upload PNG fill on facebook post automatically
Error Messages/Logs
Steps to Reproduce
Open a page with a file input (e.g., Facebook's "Create post" dialog, which has a photo/video upload button backed by a hidden <input type="file">).
Use read_page or find to locate the file input element and get its ref.
Call file_upload with that ref and a paths array containing one or more valid, existing local file paths that the session has access to (e.g., a file inside the project's own output folder).
Example call:
file_upload({
tabId: <valid tab id>,
ref: "<ref of the file input>",
paths: ["C:\\Users\\...\\output\\...\\image.png"]
})
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Code CLI version: 2.1.224
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Expected behavior
The tool sets the given file(s) on the file input element, attaching them to the page without opening a native OS file picker dialog (per the tool's own description).
Actual behavior
The call fails immediately with:
MCP error -32602: Input validation error: Invalid arguments for tool file_upload: [
{
"expected": "array",
"code": "invalid_type",
"path": ["paths"],
"message": "Invalid input: expected array, received undefined"
}
]
This happens even though paths was explicitly passed as a non-empty JSON array of strings in every attempt.
Reproducibility
Failed identically on two independent attempts, in two separate sessions, with different file paths and different element refs each time — ruling out a transient/one-off issue. The paths argument appears to never reach the tool's validation layer correctly, regardless of input.
Impact
This forces a fallback to manually clicking the visible upload button (which opens a native OS file picker that browser automation cannot see or interact with — see https://developer.chrome.com/docs/devtools sandboxing notes on native dialogs), requiring the human user to manually select files every time, defeating the purpose of the file_upload tool.
Suggested area to check
The schema validation for paths appears to reject the argument before it reaches upload logic — possibly a serialization mismatch between how the tool call is packaged by Claude and what the Chrome extension's MCP handler expects to receive.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗