FlowiseAI/Flowise · error · Error

HTTP error! status: ${response.status}

Error message

HTTP error! status: ${response.status}

What it means

downloadImgFromOpenAI uses fetch to GET `https://api.openai.com/v1/files/<id>/content`. If `response.ok` is false (non-2xx), it throws `HTTP error! status: <code>`. The status is the OpenAI Files API response code; the response body (with the reason) is not read before throwing.

Source

Thrown at packages/components/nodes/agents/OpenAIAssistant/OpenAIAssistant.ts:980

    return { filePath: path, totalSize }
}

const downloadFile = async (
    openAIApiKey: string,
    fileObj: any,
    fileName: string,
    orgId: string,
    ...paths: string[]
): Promise<{ path: string; totalSize: number }> => {
    try {
        const response = await fetch(`https://api.openai.com/v1/files/${fileObj.id}/content`, {
            method: 'GET',
            headers: { Accept: '*/*', Authorization: `Bearer ${openAIApiKey}` }
        })

        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`)
        }

        // Extract the binary data from the Response object
        const data = await response.arrayBuffer()

        // Convert the binary data to a Buffer
        const data_buffer = Buffer.from(data)
        const mime = 'application/octet-stream'

        const { path, totalSize } = await addSingleFileToStorage(mime, data_buffer, fileName, orgId, ...paths)

        return { path, totalSize }
    } catch (error) {
        console.error('Error downloading or writing the file:', error)
        return { path: '', totalSize: 0 }
    }
}

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Map the status: 404 → file deleted/missing; 401/403 → key/permission; 429 → quota; 5xx → retry.
  2. Verify the file id is correct and still present under the account.
  3. Ensure the OpenAI key used has Files read scope.
  4. For 5xx/429, retry with backoff.
  5. Patch to read the body for the reason: `const detail = await response.text(); throw new Error(\`HTTP ${response.status}: ${detail}\`)`.

Example fix

// before
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`)
        }
// after
        if (!response.ok) {
            const detail = await response.text().catch(() => '')
            throw new Error(`OpenAI Files API HTTP ${response.status}: ${detail || response.statusText}`)
        }
Defensive patterns

Strategy: retry

Try / catch

async function fetchFileWithRetry(id: string, key: string, attempts = 3) {
  for (let i = 0; i < attempts; i++) {
    try {
      return await downloadImgFromOpenAI(/*...*/)
    } catch (e) {
      const status = /status: (\d+)/.exec((e as Error).message)?.[1]
      if (status && Number(status) >= 500 && i < attempts - 1) {
        await new Promise((r) => setTimeout(r, 1000 * 2 ** i)); continue
      }
      throw e
    }
  }
}

Prevention

When it happens

Trigger: The file id no longer exists (404), the API key lacks access (401/403), rate limited (429), or OpenAI returns 5xx. Also triggered if the key is invalid.

Common situations: A file annotation references a file that was deleted from OpenAI; the assistant's key differs from the one with file access; quota exhausted; transient OpenAI outage.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/8a5f6723c6d6bf38. Report an issue: GitHub.