prestodb/presto · error · IllegalArgumentException

Execution endpoint must use HTTP or HTTPS protocol:

Error message

Execution endpoint must use HTTP or HTTPS protocol: 

What it means

The JsonBasedUdfFunctionMetadata constructor validates that an optional executionEndpoint URI uses the http or https scheme. Any other scheme (or scheme-less URI) triggers this IllegalArgumentException, because UDF execution requires an HTTP(S) endpoint to dispatch calls to.

Source

Thrown at presto-function-namespace-managers-common/src/main/java/com/facebook/presto/functionNamespace/JsonBasedUdfFunctionMetadata.java:154

        this.functionKind = requireNonNull(functionKind, "functionKind is null");
        this.outputType = requireNonNull(outputType, "outputType is null");
        this.paramTypes = ImmutableList.copyOf(requireNonNull(paramTypes, "paramTypes is null"));
        this.schema = requireNonNull(schema, "schema is null");
        this.variableArity = variableArity;
        this.routineCharacteristics = requireNonNull(routineCharacteristics, "routineCharacteristics is null");
        this.aggregateMetadata = requireNonNull(aggregateMetadata, "aggregateMetadata is null");
        checkArgument(
                (functionKind == AGGREGATE && aggregateMetadata.isPresent()) || (functionKind != AGGREGATE && !aggregateMetadata.isPresent()),
                "aggregateMetadata must be present for aggregation functions and absent otherwise");
        this.functionId = requireNonNull(functionId, "functionId is null");
        this.version = requireNonNull(version, "version is null");
        this.typeVariableConstraints = requireNonNull(typeVariableConstraints, "typeVariableConstraints is null");
        this.longVariableConstraints = requireNonNull(longVariableConstraints, "longVariableConstraints is null");
        this.executionEndpoint = requireNonNull(executionEndpoint, "executionEndpoint is null");
        executionEndpoint.ifPresent(uri -> {
            String scheme = uri.getScheme();
            if (scheme == null || (!scheme.equalsIgnoreCase("http") && !scheme.equalsIgnoreCase("https"))) {
                throw new IllegalArgumentException("Execution endpoint must use HTTP or HTTPS protocol: " + uri);
            }
        });
        this.isRpcFunction = isRpcFunction;
        this.body = requireNonNull(body, "body is null");
    }

    @JsonProperty
    public String getDocString()
    {
        return docString;
    }

    @JsonProperty
    public FunctionKind getFunctionKind()
    {
        return functionKind;
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Prefix the endpoint with http:// or https:// in the function metadata JSON.
  2. If the service is not HTTP-based, expose an HTTP(S) facade for it or remove the executionEndpoint for non-RPC functions.
  3. Validate the URI scheme before submitting/persisting function metadata.

Example fix

// before
"executionEndpoint": "my-udf-service:8080"
// after
"executionEndpoint": "http://my-udf-service:8080"
Defensive patterns

Strategy: validation

Validate before calling

URI uri = URI.create(endpoint);
if (uri.getScheme() == null ||
    !(uri.getScheme().equalsIgnoreCase("http") || uri.getScheme().equalsIgnoreCase("https"))) {
    throw new IllegalArgumentException("Endpoint must be http(s): " + endpoint);
}

Type guard

boolean isHttpEndpoint(String endpoint) {
    try {
        String s = URI.create(endpoint).getScheme();
        return s != null && (s.equalsIgnoreCase("http") || s.equalsIgnoreCase("https"));
    } catch (IllegalArgumentException e) {
        return false;
    }
}

Try / catch

try {
    JsonBasedUdfFunctionMetadata meta = parseFunctionMetadata(json);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("Execution endpoint must use HTTP or HTTPS")) {
        // fix the endpoint scheme before retrying
    }
}

Prevention

When it happens

Trigger: Constructing/decoding JsonBasedUdfFunctionMetadata from JSON where the executionEndpoint field parses to a URI with a null or non-HTTP(S) scheme (e.g. 'grpc://host:port', 'host:8080' with no scheme, 'ftp://...').

Common situations: Hand-written function catalog JSON missing the 'http://' prefix; using a different protocol like grpc or tcp for a remote UDF service; copy-pasting an endpoint from internal tooling that omits the scheme.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/6a347a51aa134f2f. Report an issue: GitHub.