{"record":{"id":"6a347a51aa134f2f","repo":"prestodb/presto","slug":"execution-endpoint-must-use-http-or-https-protocol","errorCode":null,"errorMessage":"Execution endpoint must use HTTP or HTTPS protocol: ","messagePattern":"Execution endpoint must use HTTP or HTTPS protocol: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-function-namespace-managers-common/src/main/java/com/facebook/presto/functionNamespace/JsonBasedUdfFunctionMetadata.java","lineNumber":154,"sourceCode":"        this.functionKind = requireNonNull(functionKind, \"functionKind is null\");\n        this.outputType = requireNonNull(outputType, \"outputType is null\");\n        this.paramTypes = ImmutableList.copyOf(requireNonNull(paramTypes, \"paramTypes is null\"));\n        this.schema = requireNonNull(schema, \"schema is null\");\n        this.variableArity = variableArity;\n        this.routineCharacteristics = requireNonNull(routineCharacteristics, \"routineCharacteristics is null\");\n        this.aggregateMetadata = requireNonNull(aggregateMetadata, \"aggregateMetadata is null\");\n        checkArgument(\n                (functionKind == AGGREGATE && aggregateMetadata.isPresent()) || (functionKind != AGGREGATE && !aggregateMetadata.isPresent()),\n                \"aggregateMetadata must be present for aggregation functions and absent otherwise\");\n        this.functionId = requireNonNull(functionId, \"functionId is null\");\n        this.version = requireNonNull(version, \"version is null\");\n        this.typeVariableConstraints = requireNonNull(typeVariableConstraints, \"typeVariableConstraints is null\");\n        this.longVariableConstraints = requireNonNull(longVariableConstraints, \"longVariableConstraints is null\");\n        this.executionEndpoint = requireNonNull(executionEndpoint, \"executionEndpoint is null\");\n        executionEndpoint.ifPresent(uri -> {\n            String scheme = uri.getScheme();\n            if (scheme == null || (!scheme.equalsIgnoreCase(\"http\") && !scheme.equalsIgnoreCase(\"https\"))) {\n                throw new IllegalArgumentException(\"Execution endpoint must use HTTP or HTTPS protocol: \" + uri);\n            }\n        });\n        this.isRpcFunction = isRpcFunction;\n        this.body = requireNonNull(body, \"body is null\");\n    }\n\n    @JsonProperty\n    public String getDocString()\n    {\n        return docString;\n    }\n\n    @JsonProperty\n    public FunctionKind getFunctionKind()\n    {\n        return functionKind;\n    }\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-function-namespace-managers-common/src/main/java/com/facebook/presto/functionNamespace/JsonBasedUdfFunctionMetadata.java#L136-L172","documentation":"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.","triggerScenarios":"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://...').","commonSituations":"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.","solutions":["Prefix the endpoint with http:// or https:// in the function metadata JSON.","If the service is not HTTP-based, expose an HTTP(S) facade for it or remove the executionEndpoint for non-RPC functions.","Validate the URI scheme before submitting/persisting function metadata."],"exampleFix":"// before\n\"executionEndpoint\": \"my-udf-service:8080\"\n// after\n\"executionEndpoint\": \"http://my-udf-service:8080\"","handlingStrategy":"validation","validationCode":"URI uri = URI.create(endpoint);\nif (uri.getScheme() == null ||\n    !(uri.getScheme().equalsIgnoreCase(\"http\") || uri.getScheme().equalsIgnoreCase(\"https\"))) {\n    throw new IllegalArgumentException(\"Endpoint must be http(s): \" + endpoint);\n}","typeGuard":"boolean isHttpEndpoint(String endpoint) {\n    try {\n        String s = URI.create(endpoint).getScheme();\n        return s != null && (s.equalsIgnoreCase(\"http\") || s.equalsIgnoreCase(\"https\"));\n    } catch (IllegalArgumentException e) {\n        return false;\n    }\n}","tryCatchPattern":"try {\n    JsonBasedUdfFunctionMetadata meta = parseFunctionMetadata(json);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Execution endpoint must use HTTP or HTTPS\")) {\n        // fix the endpoint scheme before retrying\n    }\n}","preventionTips":["Always include an explicit http:// or https:// scheme in endpoint configuration.","Validate function metadata JSON with a schema before submitting.","Only use HTTP(S) services for remote UDF execution.","Add a CI check that parses all function metadata files through the constructor."],"tags":["udf","url-validation","http","config"],"backgroundTag":"invalid-endpoint-scheme","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}