microsoft/semantic-kernel · error · KernelException

The address '{address}' for the '{operation.Name}' gRPC oper

Error message

The address '{address}' for the '{operation.Name}' gRPC operation is not a valid absolute URI.

What it means

Thrown after the address is non-empty but `Uri.TryCreate(address, UriKind.Absolute, ...)` fails, meaning the string is not a syntactically valid absolute URI. Relative paths, scheme-less strings, or malformed URLs all trigger this.

Source

Thrown at dotnet/src/Functions/Functions.Grpc/GrpcOperationRunner.cs:179

        string? address;

        if (this._addressOverride is not null)
        {
            address = this._addressOverride.AbsoluteUri;
        }
        else
        {
            address = operation.Address;
        }

        if (string.IsNullOrEmpty(address))
        {
            throw new KernelException($"No address provided for the '{operation.Name}' gRPC operation.");
        }

        if (!Uri.TryCreate(address, UriKind.Absolute, out var addressUri))
        {
            throw new KernelException($"The address '{address}' for the '{operation.Name}' gRPC operation is not a valid absolute URI.");
        }

        // Validate scheme
        if (!this._allowedSchemes.Contains(addressUri.Scheme, StringComparer.OrdinalIgnoreCase))
        {
            throw new KernelException($"The URI scheme '{addressUri.Scheme}' is not allowed for the '{operation.Name}' gRPC operation. Allowed schemes: {string.Join(", ", this._allowedSchemes)}.");
        }

        // Validate against allowed addresses
        if (this._allowedAddresses is { Count: > 0 })
        {
            bool isAllowed = false;
            foreach (var allowedAddress in this._allowedAddresses)
            {
                string allowedUri = allowedAddress.AbsoluteUri;

                if (addressUri.AbsoluteUri.StartsWith(allowedUri, StringComparison.OrdinalIgnoreCase))
                {

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Prefix the address with a scheme, e.g. `https://localhost:5001`.
  2. Trim whitespace and validate with Uri.TryCreate yourself before registering.
  3. Use a Uri instance for AddressOverride rather than a raw string.

Example fix

// before
address = "localhost:5001";
// after
address = "https://localhost:5001";
Defensive patterns

Strategy: validation

Validate before calling

if (!Uri.TryCreate(address, UriKind.Absolute, out _))
    throw new InvalidOperationException($"Address is not an absolute URI: {address}");

Prevention

When it happens

Trigger: Address string like `localhost:5001`, `//service`, `/api`, or containing illegal characters that cannot be parsed as an absolute Uri.

Common situations: Omitting the scheme (`https://`); a typo; a templated placeholder that was never substituted; trailing/leading whitespace.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/2b76f4560e39c0b2. Report an issue: GitHub.