prestodb/presto · error · PrestoException
GENERIC_USER_ERROR
GENERIC_USER_ERROR
Error message
Remote functions are not enabled
What it means
Remote (server-side external) functions are gated behind a session/config flag. PlanRemoteProjections detects remote-function calls in a projection; if any exist but the remote-functions feature is disabled, it throws GENERIC_USER_ERROR telling the user to enable the feature.
Source
Thrown at presto-main-base/src/main/java/com/facebook/presto/sql/planner/iterative/rule/PlanRemoteProjections.java:95
public Pattern<ProjectNode> getPattern()
{
return PATTERN;
}
@Override
public Result apply(ProjectNode node, Captures captures, Rule.Context context)
{
if (!node.getLocality().equals(UNKNOWN)) {
// Already planned
return Result.empty();
}
// Fast check for remote functions
if (node.getAssignments().getExpressions().stream().noneMatch(expression -> expression.accept(new ExternalCallExpressionChecker(functionAndTypeManager), null))) {
// No remote function
return Result.ofPlanNode(new ProjectNode(node.getSourceLocation(), node.getId(), node.getSource(), node.getAssignments(), LOCAL));
}
if (!isRemoteFunctionsEnabled(context.getSession())) {
throw new PrestoException(GENERIC_USER_ERROR, "Remote functions are not enabled");
}
List<ProjectionContext> projectionContexts = planRemoteAssignments(node.getAssignments(), context.getVariableAllocator());
checkState(!projectionContexts.isEmpty(), "Expect non-empty projectionContexts");
PlanNode rewritten = node.getSource();
for (ProjectionContext projectionContext : projectionContexts) {
rewritten = new ProjectNode(node.getSourceLocation(), context.getIdAllocator().getNextId(), rewritten, Assignments.builder().putAll(projectionContext.getProjections()).build(), projectionContext.remote ? REMOTE : LOCAL);
}
return Result.ofPlanNode(rewritten);
}
@VisibleForTesting
public List<ProjectionContext> planRemoteAssignments(Assignments assignments, VariableAllocator variableAllocator)
{
ImmutableList.Builder<List<ProjectionContext>> assignmentProjections = ImmutableList.builder();
for (Map.Entry<VariableReferenceExpression, RowExpression> entry : assignments.getMap().entrySet()) {
List<ProjectionContext> rewritten = entry.getValue().accept(new Visitor(functionAndTypeManager, variableAllocator), null);
if (rewritten.isEmpty()) {
assignmentProjections.add(ImmutableList.of(new ProjectionContext(ImmutableMap.of(entry.getKey(), entry.getValue()), false)));View on GitHub (pinned to 55bb57d202)
Solutions
- Enable it: SET SESSION remote_functions_enabled = true
- Set remote-functions-enabled=true in the coordinator config.properties
- Remove or replace the remote function with a local UDF if the feature cannot be enabled
Example fix
// before SELECT remote_model_classify(text) FROM messages; -- flag off // after SET SESSION remote_functions_enabled = true; SELECT remote_model_classify(text) FROM messages;
Defensive patterns
Strategy: try-catch
Validate before calling
SHOW SESSION LIKE 'remote_functions_enabled';
Type guard
null
Try / catch
try {
return query(sql);
} catch (PrestoException e) {
if (e.getErrorCode() == GENERIC_USER_ERROR.toErrorCode() && e.getMessage().contains("Remote functions")) {
setSessionProperty("remote_functions_enabled", "true");
return retryQuery(sql);
}
throw e;
} Prevention
- Enable remote-functions-enabled on clusters that will run remote UDFs
- Check the flag in session setup code before issuing remote-function queries
- Document which functions are remote so users know the dependency
When it happens
Trigger: A query projection references an external/remote function (matched by ExternalCallExpressionChecker) while 'remote-functions-enabled' is false in the session or config.
Common situations: Calling remote functions on a cluster without the flag enabled; config migrated from a cluster where remote functions were on; testing AI/remote UDFs without enabling the feature.
Related errors
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/618f1a64b7b2d9bb.
Report an issue: GitHub.