microsoft/aspire · error · InvalidOperationException

Endpoint is unavailable

Error message

Endpoint is unavailable

What it means

CreateQdrantClient parses the connection string into an endpoint and optional key. If the string parses (or is present) but no endpoint could be extracted — e.g. it is a key/value pair lacking an 'Endpoint' entry, or the URI could not be created — it throws InvalidOperationException('Endpoint is unavailable'). A QdrantClient cannot be constructed without an endpoint URI.

Solutions

  1. Include an 'Endpoint' key in the connection string, e.g. 'Endpoint=http://localhost:6334;Key=secret'.
  2. Or pass the connection string as a plain absolute URI like 'http://localhost:6334'.
  3. Fix typos in the key name so it exactly matches 'Endpoint'.
  4. Validate the URL is absolute and well-formed (scheme + host).

Example fix

// before
"Key=secret"

// after
"Endpoint=http://localhost:6334;Key=secret"
Defensive patterns

Strategy: validation

Validate before calling

// Validate the connection string shape before wiring it in
if (!Uri.TryCreate(connectionString, UriKind.Absolute, out _) &&
    !connectionString.Contains("Endpoint=", StringComparison.OrdinalIgnoreCase))
{
    throw new InvalidOperationException("Qdrant connection string must be an absolute URI or contain 'Endpoint=<uri>'.");
}

Prevention

When it happens

Trigger: Passing a connection string that is not an absolute URI and whose key/value pairs do not contain an 'Endpoint' key, so `endpoint` remains null after parsing.

Common situations: Supplying only 'Key=...' in the connection string; using a relative or malformed URL; typos like 'endpoint=' lowercase is fine but 'Url=' or 'Host=' are not recognized; copying a connection string format from a different provider.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/3f5ce9f25322d3cb. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting.Qdrant/QdrantBuilderExtensions.cs:228

            var connectionBuilder = new DbConnectionStringBuilder
            {
                ConnectionString = connectionString
            };

            if (connectionBuilder.TryGetValue("Endpoint", out var endpointValue) && Uri.TryCreate(endpointValue.ToString(), UriKind.Absolute, out var serviceUri))
            {
                endpoint = serviceUri;
            }

            if (connectionBuilder.TryGetValue("Key", out var keyValue))
            {
                key = keyValue.ToString();
            }
        }

        if (endpoint is null)
        {
            throw new InvalidOperationException("Endpoint is unavailable");
        }

        var client = new QdrantClient(endpoint, key);
        return client;
    }
}

View on GitHub (pinned to 25830f84bd)