n8n-io/n8n · error · UserError

Invalid Qdrant URL: ${url}. Please provide a valid URL with

Error message

Invalid Qdrant URL: ${url}. Please provide a valid URL with protocol (http/https)

What it means

Thrown as a UserError by `parseQdrantUrl` when `new URL(url)` raises — the supplied Qdrant URL is not parseable. The function expects a full URL including a protocol (`http://` or `https://`); without a protocol the URL constructor throws. Because it is a UserError, n8n treats it as a user-fixable configuration problem, not a transient operational issue.

Source

Thrown at packages/@n8n/nodes-langchain/nodes/vector_store/VectorStoreQdrant/Qdrant.utils.ts:22

export type QdrantCredential = {
	qdrantUrl: string;
	apiKey: string;
};

function parseQdrantUrl(url: string): { protocol: string; host: string; port: number } {
	try {
		const parsedUrl = new URL(url);
		return {
			protocol: parsedUrl.protocol,
			host: parsedUrl.hostname,
			port: parsedUrl.port
				? parseInt(parsedUrl.port, 10)
				: parsedUrl.protocol === 'https:'
					? 443
					: 80,
		};
	} catch (error) {
		throw new UserError(
			`Invalid Qdrant URL: ${url}. Please provide a valid URL with protocol (http/https)`,
		);
	}
}

export function createQdrantClient(credentials: QdrantCredential): QdrantClient {
	const { protocol, host, port } = parseQdrantUrl(credentials.qdrantUrl);

	const qdrantClient = new QdrantClient({
		host,
		apiKey: credentials.apiKey,
		https: protocol === 'https:',
		port,
	});

	return qdrantClient;
}

View on GitHub (pinned to 5ac6606e81)

Solutions

  1. Prefix the URL with `http://` or `https://` (e.g. `http://localhost:6333`).
  2. Use the Qdrant default ports: 6333 for HTTP, 6334 for gRPC.
  3. If behind TLS, use `https://` and the matching port.
  4. Trim whitespace from the credential value before saving.

Example fix

// before
const parsedUrl = new URL(url);

// after: tolerate a missing protocol by defaulting to http
const normalized = /^https?:\/\//i.test(url) ? url : `http://${url}`;
const parsedUrl = new URL(normalized);
Defensive patterns

Strategy: validation

Validate before calling

// Normalize the URL before parsing so a missing protocol is not fatal.
function normalizeUrl(input: string): string {
  const trimmed = input.trim();
  if (!trimmed) throw new UserError('Qdrant URL is required');
  return /^https?:\/\//i.test(trimmed) ? trimmed : `http://${trimmed}`;
}
const parsedUrl = new URL(normalizeUrl(credentials.qdrantUrl));

Type guard

function isHttpUrl(value: string): boolean {
  try {
    const u = new URL(value);
    return u.protocol === 'http:' || u.protocol === 'https:';
  } catch {
    return false;
  }
}

Try / catch

// Validate at the credential boundary, not deep inside the client builder.
if (!isHttpUrl(credentials.qdrantUrl)) {
  throw new UserError(`Invalid Qdrant URL: ${credentials.qdrantUrl}. Please provide a valid URL with protocol (http/https)`);
}

Prevention

When it happens

Trigger: User enters `localhost:6333` (no protocol), `qdrant.example.com` (no protocol), an empty string, a URL with an unsupported scheme like `ftp://`, or a value with illegal characters / spaces.

Common situations: Copy-paste from a config file that omits the protocol; mistyping `http//` (missing colon); trailing slash or path expected by Qdrant but missing; environment variable resolving to empty at runtime.

Related errors


AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12). Data as JSON: /api/errors/8f93abfc56a6d0e5. Report an issue: GitHub.