prestodb/presto · error · IllegalArgumentException
owner cannot be present with runAsInvoker
Error message
owner cannot be present with runAsInvoker
What it means
ViewDefinition describes a view's definition including its owner and runAsInvoker semantics. The constructor enforces an invariant: runAsInvoker=true means the view always runs with the invoking user's identity, so an owner must not also be present; otherwise IllegalArgumentException("owner cannot be present with runAsInvoker") is thrown.
Source
Thrown at presto-spi/src/main/java/com/facebook/presto/spi/analyzer/ViewDefinition.java:51
private final boolean runAsInvoker;
@JsonCreator
public ViewDefinition(
@JsonProperty("originalSql") String originalSql,
@JsonProperty("catalog") Optional<String> catalog,
@JsonProperty("schema") Optional<String> schema,
@JsonProperty("columns") List<ViewColumn> columns,
@JsonProperty("owner") Optional<String> owner,
@JsonProperty("runAsInvoker") boolean runAsInvoker)
{
this.originalSql = requireNonNull(originalSql, "originalSql is null");
this.catalog = requireNonNull(catalog, "catalog is null");
this.schema = requireNonNull(schema, "schema is null");
this.columns = unmodifiableList(requireNonNull(columns, "columns is null"));
this.owner = requireNonNull(owner, "owner is null");
this.runAsInvoker = runAsInvoker;
if (runAsInvoker && owner.isPresent()) {
throw new IllegalArgumentException("owner cannot be present with runAsInvoker");
}
}
@JsonProperty
public String getOriginalSql()
{
return originalSql;
}
@JsonProperty
public Optional<String> getCatalog()
{
return catalog;
}
@JsonProperty
public Optional<String> getSchema()
{View on GitHub (pinned to 55bb57d202)
Solutions
- Set owner to Optional.empty() when runAsInvoker is true
- Set runAsInvoker=false if the view should keep its owner's privileges
- Sanitize deserialized view definitions before constructing ViewDefinition
Example fix
// before new ViewDefinition(originalSql, catalog, schema, columns, Optional.of(owner), true, ...); // after new ViewDefinition(originalSql, catalog, schema, columns, Optional.empty(), true, ...);
Defensive patterns
Strategy: validation
Validate before calling
if (runAsInvoker) owner = Optional.empty();
Prevention
- Centralize ViewDefinition construction in one helper enforcing the owner/runAsInvoker invariant
- Sanitize view definition JSON on import/migration before constructing the object
When it happens
Trigger: Constructing ViewDefinition (or deserializing its JSON/Thrift form) with owner=Optional.of(...) and runAsInvoker=true.
Common situations: Programmatic view migration tools that preserve the original owner while also setting runAsInvoker; hand-edited view definition JSON; connectors constructing ViewDefinition without clearing owner when switching to invoker semantics.
Related errors
- partitionHandle must be NOT_PARTITIONED
- Invalid NodeState value:
- SchemaTableName should have exactly 2 parts
- value must be > 0, found:
- Invalid weight:
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/cbbaf85369faf4c3.
Report an issue: GitHub.