Skip to content

fix: File inputs appended to form data twice - #29

Merged
montyanderson merged 2 commits into
masterfrom
fix/duplicate-file-input
Aug 31, 2026
Merged

montyanderson merged 2 commits into
masterfrom
fix/duplicate-file-input

Conversation

@prodiapcode

Copy link
Copy Markdown
Contributor

Problem

Passing a File as a job input causes the SDK to append it to the multipart form twice, so single-input job types fail with:

one input is required, but 2 received

(reported by a customer against inference.mask-background.v1, job f4082120-4b42-4452-8866-f84d219cb853)

Cause

The input-type checks in v2/index.ts were sequential if statements. Since File extends Blob, a File input matched both the File branch (appended with its real name) and the Blob branch (appended again as image.jpg).

Fix

Make the branches mutually exclusive with else if, checking File first. Blob, Uint8Array, and ArrayBuffer inputs were already mutually exclusive and are unaffected.

Verification

Reproduced the double-append with the old logic (formData.getAll("input").length === 2 for one File), confirmed the new logic appends exactly one entry per input for all four input types, and tsc --noEmit passes.

🤖 Generated with Claude Code

Monty (Claude Code) and others added 2 commits August 31, 2026 16:08
File extends Blob, so a File input matched both the File and Blob
branches and was appended twice, causing jobs to fail with
"one input is required, but 2 received".

Co-Authored-By: Claude Fable 5 <[email protected]>
CI's node-test jobs use the runner's global tsc (currently TS 7),
which removed the node10 moduleResolution and baseUrl options.
module/moduleResolution node16 still emits CommonJS here (no
"type": "module" in package.json) and builds on both TS 5 and TS 7.

Co-Authored-By: Claude Fable 5 <[email protected]>
@montyanderson
montyanderson marked this pull request as ready for review August 31, 2026 15:12
@montyanderson
montyanderson merged commit 7802d8b into master Aug 31, 2026
8 checks passed
@prodiapcode prodiapcode mentioned this pull request Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants