{"record":{"id":"839752ef1988e709","repo":"FlowiseAI/Flowise","slug":"failed-to-fetch-url-error","errorCode":null,"errorMessage":"Failed to fetch ${url}: ${error}","messagePattern":"Failed to fetch (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/nodes/documentloaders/API/APILoader.ts","lineNumber":271,"sourceCode":"            return this.executeGetRequest(this.url, this.headers, this.ca)\n        }\n    }\n\n    protected async executeGetRequest(url: string, headers?: ICommonObject, ca?: string): Promise<IDocument[]> {\n        try {\n            const config: AxiosRequestConfig = { method: 'GET', url, headers: headers ?? {} }\n            const agentOptions = ca ? { ca } : undefined\n            const response = await secureAxiosRequest(config, 5, agentOptions)\n            const responseJsonString = JSON.stringify(response.data, null, 2)\n            const doc = new Document({\n                pageContent: responseJsonString,\n                metadata: {\n                    url\n                }\n            })\n            return [doc]\n        } catch (error) {\n            throw new Error(`Failed to fetch ${url}: ${error}`)\n        }\n    }\n\n    protected async executePostRequest(url: string, headers?: ICommonObject, body?: ICommonObject, ca?: string): Promise<IDocument[]> {\n        try {\n            const config: AxiosRequestConfig = { method: 'POST', url, data: body ?? {}, headers: headers ?? {} }\n            const agentOptions = ca ? { ca } : undefined\n            const response = await secureAxiosRequest(config, 5, agentOptions)\n            const responseJsonString = JSON.stringify(response.data, null, 2)\n            const doc = new Document({\n                pageContent: responseJsonString,\n                metadata: {\n                    url\n                }\n            })\n            return [doc]\n        } catch (error) {\n            throw new Error(`Failed to post ${url}: ${error}`)","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/nodes/documentloaders/API/APILoader.ts#L253-L289","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the URL is reachable from the Flowise host (curl -v <url>) and check DNS/proxy egress.","For self-signed/internal HTTPS, pass the matching ca in the node's CA field.","Confirm auth headers are set correctly (Authorization, API-Key) to avoid 401/403.","Inspect the wrapped error message — it contains the underlying axios error text which pinpoints DNS vs TLS vs status code.","If the endpoint is rate-limited, raise the retry count or reduce request frequency rather than relying on the default 5."],"exampleFix":"// before\nurl = 'http://internal-api.local/data' // unreachable from host -> throws [99]\n\n// after\nurl = 'https://api.example.com/data'\nheaders = { Authorization: `Bearer ${token}` }\nca = fs.readFileSync('./corp-ca.pem', 'utf8') // for self-signed internal endpoints","handlingStrategy":"retry","validationCode":"function assertReachableUrl(url) {\n  try { new URL(url) }\n  catch { throw new Error(`APILoader URL is malformed: ${url}`) }\n  if (!/^https?:\\/\\//.test(url)) throw new Error(`APILoader URL must be http(s): ${url}`)\n}\nassertReachableUrl(url)\n// Optionally pre-flight a HEAD (omitted here to avoid double requests in prod)","typeGuard":"function isHttpUrl(v: unknown): v is string {\n  if (typeof v !== 'string') return false\n  try { const u = new URL(v); return u.protocol === 'http:' || u.protocol === 'https:' } catch { return false }\n}","tryCatchPattern":"try {\n  return await loader.load()\n} catch (e) {\n  if (e.message.startsWith('Failed to fetch ') && /ETIMEDOUT|ECONNRESET|429|5\\d\\d/.test(e.message)) {\n    await new Promise(r => setTimeout(r, 1000))\n    return await loader.load()\n  }\n  throw new Error(`APILoader GET failed permanently: ${e.message}`)\n}","preventionTips":["Pre-validate the URL shape (http/https, valid host) before invoking the loader.","Provide the matching CA for self-signed internal endpoints.","Set correct auth headers to avoid 401/403 wrapping.","Inspect the wrapped message — it carries the underlying axios error text.","Tune secureAxiosRequest retry count for rate-limited endpoints rather than failing after 5."],"tags":["network","http","axios","retry","tls","document-loader"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}