FlowiseAI/Flowise · error · Error

Failed to fetch ${url}: ${error}

Error message

Failed to fetch ${url}: ${error}

What it means

APILoader's executeGetRequest wraps the secureAxiosRequest call in a try/catch and re-wraps any thrown error with the target url and the original error. The original error (network, DNS, TLS via the ca option, 4xx/5xx, or the 5-retry exhaustion inside secureAxiosRequest) is stringified into the message.

Source

Thrown at packages/components/nodes/documentloaders/API/APILoader.ts:271

            return this.executeGetRequest(this.url, this.headers, this.ca)
        }
    }

    protected async executeGetRequest(url: string, headers?: ICommonObject, ca?: string): Promise<IDocument[]> {
        try {
            const config: AxiosRequestConfig = { method: 'GET', url, headers: headers ?? {} }
            const agentOptions = ca ? { ca } : undefined
            const response = await secureAxiosRequest(config, 5, agentOptions)
            const responseJsonString = JSON.stringify(response.data, null, 2)
            const doc = new Document({
                pageContent: responseJsonString,
                metadata: {
                    url
                }
            })
            return [doc]
        } catch (error) {
            throw new Error(`Failed to fetch ${url}: ${error}`)
        }
    }

    protected async executePostRequest(url: string, headers?: ICommonObject, body?: ICommonObject, ca?: string): Promise<IDocument[]> {
        try {
            const config: AxiosRequestConfig = { method: 'POST', url, data: body ?? {}, headers: headers ?? {} }
            const agentOptions = ca ? { ca } : undefined
            const response = await secureAxiosRequest(config, 5, agentOptions)
            const responseJsonString = JSON.stringify(response.data, null, 2)
            const doc = new Document({
                pageContent: responseJsonString,
                metadata: {
                    url
                }
            })
            return [doc]
        } catch (error) {
            throw new Error(`Failed to post ${url}: ${error}`)

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Verify the URL is reachable from the Flowise host (curl -v <url>) and check DNS/proxy egress.
  2. For self-signed/internal HTTPS, pass the matching ca in the node's CA field.
  3. Confirm auth headers are set correctly (Authorization, API-Key) to avoid 401/403.
  4. Inspect the wrapped error message — it contains the underlying axios error text which pinpoints DNS vs TLS vs status code.
  5. If the endpoint is rate-limited, raise the retry count or reduce request frequency rather than relying on the default 5.

Example fix

// before
url = 'http://internal-api.local/data' // unreachable from host -> throws [99]

// after
url = 'https://api.example.com/data'
headers = { Authorization: `Bearer ${token}` }
ca = fs.readFileSync('./corp-ca.pem', 'utf8') // for self-signed internal endpoints
Defensive patterns

Strategy: retry

Validate before calling

function assertReachableUrl(url) {
  try { new URL(url) }
  catch { throw new Error(`APILoader URL is malformed: ${url}`) }
  if (!/^https?:\/\//.test(url)) throw new Error(`APILoader URL must be http(s): ${url}`)
}
assertReachableUrl(url)
// Optionally pre-flight a HEAD (omitted here to avoid double requests in prod)

Type guard

function isHttpUrl(v: unknown): v is string {
  if (typeof v !== 'string') return false
  try { const u = new URL(v); return u.protocol === 'http:' || u.protocol === 'https:' } catch { return false }
}

Try / catch

try {
  return await loader.load()
} catch (e) {
  if (e.message.startsWith('Failed to fetch ') && /ETIMEDOUT|ECONNRESET|429|5\d\d/.test(e.message)) {
    await new Promise(r => setTimeout(r, 1000))
    return await loader.load()
  }
  throw new Error(`APILoader GET failed permanently: ${e.message}`)
}

Prevention

When it happens

Trigger: The GET request to `url` fails after up to 5 retries inside secureAxiosRequest: DNS resolution failure, connection refused, TLS handshake error (especially with a custom ca), timeout, or an HTTP 4xx/5xx that secureAxiosRequest treats as fatal. The catch wraps the underlying axios error.

Common situations: Wrong/typo URL or unreachable host behind a corporate proxy; self-signed cert without the matching ca provided; endpoint returns 401/403/404/500; endpoint is on an internal network not reachable from the Flowise host; rate-limited public API exhausting the 5 retries; missing https where http is given.

Related errors


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