nodejs/node · warning · NotSupportedError
UND_ERR_NOT_SUPPORTED
UND_ERR_NOT_SUPPORTED
Error message
Not supported error
What it means
Thrown as NotSupportedError (code UND_ERR_NOT_SUPPORTED) by the fetch Body/Response .formData() method in undici's readable.js. Parsing multipart/form-data and application/x-www-form-urlencoded bodies into FormData is intentionally not implemented (the source marks it TODO). Calling .formData() on any Response always throws, regardless of the Content-Type.
Source
Thrown at deps/undici/src/lib/api/readable.js:227
/**
* Consumes and returns the body as an ArrayBuffer.
*
* @see https://fetch.spec.whatwg.org/#dom-body-arraybuffer
* @returns {Promise<ArrayBuffer>}
*/
arrayBuffer () {
return consume(this, 'arrayBuffer')
}
/**
* Not implemented
*
* @see https://fetch.spec.whatwg.org/#dom-body-formdata
* @throws {NotSupportedError}
*/
async formData () {
// TODO: Implement.
throw new NotSupportedError()
}
/**
* Returns true if the body is not null and the body has been consumed.
* Otherwise, returns false.
*
* @see https://fetch.spec.whatwg.org/#dom-body-bodyused
* @readonly
* @returns {boolean}
*/
get bodyUsed () {
return util.isDisturbed(this)
}
/**
* @see https://fetch.spec.whatwg.org/#dom-body-body
* @readonly
* @returns {ReadableStream}View on GitHub (pinned to 1b2de5e052)
Solutions
- Parse the body manually: for multipart use a parser like busboy/formdata-node/undici's own multipart utility; for urlencoded use new URLSearchParams(await res.text()).
- If you control the server, have it return JSON instead of form-encoded bodies.
- Upgrade undici — check release notes; if formData support landed, update to that version. Until then treat formData() as unavailable.
Example fix
// before
const form = await response.formData()
// after (urlencoded)
const params = new URLSearchParams(await response.text())
const value = params.get('field')
// or (multipart) use a dedicated parser such as formdata-node/busboy Defensive patterns
Strategy: fallback
Validate before calling
async function readFormData(response) {
const ct = response.headers.get('content-type') || ''
const text = await response.text()
if (ct.includes('application/x-www-form-urlencoded')) {
return new URLSearchParams(text)
}
// multipart: delegate to busboy/formdata-node
throw new Error('multipart formData parsing not supported by undici; use busboy')
} Type guard
function isFormDataSupported() { return false } // undici formData() is unimplemented Try / catch
try {
const form = await response.formData()
} catch (e) {
if (e.code === 'UND_ERR_NOT_SUPPORTED') {
// fall back to manual URLSearchParams or a multipart parser
} else throw e
} Prevention
- Never call response.formData() on undici — it is a known unimplemented stub.
- Parse urlencoded bodies with new URLSearchParams(await res.text()).
- Parse multipart with busboy/formdata-node, or have the server emit JSON.
- Watch undici release notes for native formData() support.
When it happens
Trigger: Calling const form = await response.formData() on an undici fetch Response, even when the body is multipart/form-data. This is a hard unimplemented stub, not a runtime/content condition.
Common situations: Porting browser fetch code that uses response.formData() to Node/undici; handling file upload responses; parsing webhook payloads that are form-encoded.
Related errors
- UND_ERR_REQ_CONTENT_LENGTH_MISMATCH
- UND_ERR_REQ_CONTENT_LENGTH_MISMATCH
- UND_ERR_INVALID_ARG
- UND_ERR_INVALID_ARG
- UND_ERR_SOCKET
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/3d33f4ea7b3bc3f5.
Report an issue: GitHub.