continuedev/continue · error · TypeError
node-fetch cannot load ${url}. URL scheme "${parsedURL.proto
Error message
node-fetch cannot load ${url}. URL scheme "${parsedURL.protocol.replace(/:$/, "")}" is not supported. What it means
node-fetch (patched in packages/fetch) only supports http:, https:, data:, etc. — this TypeError is thrown when the URL's protocol isn't in the supported set.
Source
Thrown at packages/fetch/src/node-fetch-patch.js:77
Response,
};
const supportedSchemas = new Set(["data:", "http:", "https:"]);
/**
* Fetch function
*
* @param {string | URL | import('./request').default} url - Absolute url or Request instance
* @param {*} [options_] - Fetch options
* @return {Promise<import('./response').default>}
*/
export default async function fetch(url, options_) {
return new Promise((resolve, reject) => {
// Build request object
const request = new Request(url, options_);
const { parsedURL, options } = getNodeRequestOptions(request);
if (!supportedSchemas.has(parsedURL.protocol)) {
throw new TypeError(
`node-fetch cannot load ${url}. URL scheme "${parsedURL.protocol.replace(/:$/, "")}" is not supported.`,
);
}
if (parsedURL.protocol === "data:") {
const data = dataUriToBuffer(request.url);
const response = new Response(data, {
headers: { "Content-Type": data.typeFull },
});
resolve(response);
return;
}
// Wrap http.request into fetch
const send = (parsedURL.protocol === "https:" ? https : http).request;
const { signal } = request;
let response = null;
View on GitHub (pinned to 5522c6f44c)
Solutions
- Use an http:// or https:// URL
- Prefix bare hostnames with https:// (url = `https://${host}${path}`)
- Read local files with fs instead of fetch
- Validate protocol with new URL(...) and a whitelist before fetching
Example fix
// before
await fetch('localhost:8080/v1/chat');
// after
await fetch('http://localhost:8080/v1/chat'); Defensive patterns
Strategy: validation
Validate before calling
const u = new URL(url, baseURL); if (!['http:','https:'].includes(u.protocol)) throw new TypeError('unsupported scheme'); Type guard
function isHttpUrl(s: string): boolean { try { return ['http:', 'https:'].includes(new URL(s).protocol); } catch { return false; } } Try / catch
try { await fetch(url); } catch (e) { if (e instanceof TypeError && /URL scheme/.test(e.message)) { /* fix scheme or use fs */ } else throw e; } Prevention
- Always construct URLs via new URL(path, base)
- Prepend https:// to scheme-less hostnames
- Use fs for local files instead of fetch
When it happens
Trigger: Calling fetch('ftp://...'), fetch('file:///...'), or a malformed relative URL whose parsed protocol is unsupported.
Common situations: Passing a file path instead of a URL, misconfigured base URLs (missing scheme), or feeding browser-style URLs to the Node fetch polyfill.
Related errors
- HTTP ${resp.status} ${resp.statusText}
- Invalid URL-based MCP tool reference "${toolRef}": the part
- Table name must be in format schema.table_name, got ${tableN
- Only rule files can be deleted
- FindAndReplaceMissingOldString
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/3ad58a0126289c30.
Report an issue: GitHub.