langgenius/dify · error · FileUploadError

Legacy FormData must be a readable stream when used with fet

Error message

Legacy FormData must be a readable stream when used with fetch

What it means

Error "Legacy FormData must be a readable stream when used with fetch" thrown in langgenius/dify.

Source

Thrown at sdks/nodejs-client/src/http/client.ts:256

}

const prepareRequestBody = (
  method: RequestMethod,
  data: HttpRequestBody | undefined,
): PreparedRequestBody => {
  if (method === 'GET' || data === undefined) {
    return {
      body: undefined,
      headers: {},
      replayable: true,
    }
  }

  if (isFormData(data)) {
    if ('getHeaders' in data && typeof data.getHeaders === 'function') {
      const readable = toNodeReadable(data)
      if (!readable) {
        throw new FileUploadError('Legacy FormData must be a readable stream when used with fetch')
      }
      return {
        body: Readable.toWeb(readable) as BodyInit,
        headers: getFormDataHeaders(data),
        duplex: 'half',
        replayable: false,
      }
    }
    return {
      body: data as BodyInit,
      headers: getFormDataHeaders(data),
      replayable: true,
    }
  }

  if (typeof data === 'string') {
    return {
      body: data,

View on GitHub (pinned to ef8544b173)

When it happens

Trigger: Thrown at sdks/nodejs-client/src/http/client.ts:256 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of langgenius/dify@ef8544b173 (2026-08-12). Data as JSON: /api/errors/ae1bd6560e0a0311. Report an issue: GitHub.