prestodb/presto · error · PrestoException

INVALID_SCHEMA_PROPERTY

INVALID_SCHEMA_PROPERTY

Error message

Invalid location URI: 

What it means

When CREATE SCHEMA specifies a location, Presto validates it by opening a FileSystem handle for that URI through hdfsEnvironment. If the location URI is malformed or inaccessible (IOException), it throws INVALID_SCHEMA_PROPERTY with 'Invalid location URI: <uri>'. This guards against creating schemas pointing at unusable storage.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java:1009

     * Returns a TupleDomain of constraints that is suitable for Explain (Type IO)
     * <p>
     * Only Hive partition columns that are used in IO planning.
     */
    @Override
    public TupleDomain<ColumnHandle> toExplainIOConstraints(ConnectorSession session, ConnectorTableHandle tableHandle, TupleDomain<ColumnHandle> constraints)
    {
        return constraints.transform(columnHandle -> ((HiveColumnHandle) columnHandle).isPartitionKey() ? columnHandle : null);
    }

    @Override
    public void createSchema(ConnectorSession session, String schemaName, Map<String, Object> properties)
    {
        Optional<String> location = SchemaProperties.getLocation(properties).map(locationUri -> {
            try {
                hdfsEnvironment.getFileSystem(new HdfsContext(session, schemaName), new Path(locationUri));
            }
            catch (IOException e) {
                throw new PrestoException(INVALID_SCHEMA_PROPERTY, "Invalid location URI: " + locationUri, e);
            }
            return locationUri;
        });

        Database database = Database.builder()
                .setDatabaseName(schemaName)
                .setLocation(location)
                .setOwnerType(USER)
                .setOwnerName(session.getUser())
                .build();

        metastore.createDatabase(getMetastoreContext(session), database);
    }

    @Override
    public void dropSchema(ConnectorSession session, String schemaName)
    {
        // basic sanity check to provide a better error message

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Fix the location URI in the CREATE SCHEMA statement (correct scheme and host, e.g. hdfs://namenode:8020/path)
  2. Verify the URI is reachable with the same credentials: run hdfs dfs -ls <uri> or equivalent
  3. Check presto HdfsConfiguration (core-site.xml/hive.properties fs.location or native filesystem settings) supports the scheme
  4. Check HDFS permissions/ACLs for the Presto service user on the target path

Example fix

// before
CREATE SCHEMA web WITH (location = 'hdfs:/data/web');
// after
CREATE SCHEMA web WITH (location = 'hdfs://namenode:8020/data/web');
Defensive patterns

Strategy: validation

Validate before calling

// validate before CREATE SCHEMA
Path path = new Path(locationUri);
Configuration conf = new Configuration();
FileSystem fs = path.getFileSystem(conf);
fs.exists(path); // throws IOException if URI/scheme invalid or unreachable

Type guard

boolean isValidLocationUri(String uri) {
    try { new Path(uri); return uri.matches("^[a-z][a-z0-9+.-]*://.+"); }
    catch (IllegalArgumentException e) { return false; }
}

Try / catch

try {
    connector.createSchema(session, schemaName, properties);
} catch (PrestoException e) {
    if (e.getErrorCode().getCode() == StandardErrorCode.INVALID_SCHEMA_PROPERTY.code()) {
        // log e.getCause() (IOException) to see actual HDFS failure; fix URI or credentials
    } else { throw e; }
}

Prevention

When it happens

Trigger: Calling CREATE SCHEMA ... WITH (location = 'uri') where the URI cannot be resolved by the configured filesystem (bad scheme, missing HDFS, permissions causing IOException, typo like 'hdfs:/name' or a path with invalid characters).

Common situations: Typos in the location URI; HDFS NameNode unreachable or misconfigured fs.defaultFS; S3/ABFS scheme not registered in the Presto HDFS configuration; Kerberos/HDFS permission errors surfacing as IOException.

Related errors


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