prestodb/presto · error · PrestoException

INVALID_SCHEMA_PROPERTY

INVALID_SCHEMA_PROPERTY

Error message

Invalid location URI: 

What it means

createSchema() validates an optional LOCATION property by probing the filesystem via HdfsEnvironment before creating the database. If the URI is malformed (IllegalArgumentException) or the filesystem access fails (IOException), Presto throws PrestoException with code INVALID_SCHEMA_PROPERTY, indicating the user-supplied location URI is unusable.

Source

Thrown at presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java:336

        return schemaNames.stream()
                .flatMap(schema -> metastore
                        .getAllTables(metastoreContext, schema)
                        .orElseGet(() -> ImmutableList.of())
                        .stream()
                        .map(table -> new SchemaTableName(schema, table)))
                .collect(toImmutableList());
    }

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

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

        MetastoreContext metastoreContext = getMetastoreContext(session);
        metastore.createDatabase(metastoreContext, database);
    }

    @Override
    public void dropSchema(ConnectorSession session, String schemaName)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Check the location URI syntax and scheme (must be a fully qualified, valid Path)
  2. Verify the path exists or is creatable and the Presto service user has write access on the target filesystem
  3. Confirm filesystem credentials/config (core-site.xml, s3 credentials in catalog properties) are present on coordinators and workers
  4. Retry CREATE SCHEMA with a corrected or omitted location property

Example fix

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

Strategy: validation

Validate before calling

-- Validate the location URI before CREATE SCHEMA
-- (check scheme is fully qualified and path is accessible from Presto):
CREATE SCHEMA IF NOT EXISTS sales WITH (location = 'hdfs://namenode:8020/warehouse/sales');

Try / catch

try {
    stmt.execute("CREATE SCHEMA sales WITH (location='" + uri + "')");
} catch (SQLException e) {
    if (e.getMessage() != null && e.getMessage().contains("Invalid location URI")) {
        // fix URI / check filesystem access & credentials, then retry
    } else { throw e; }
}

Prevention

When it happens

Trigger: CREATE SCHEMA ... WITH (location = 'uri') where the URI is malformed, points to a non-existent/inaccessible HDFS or S3 path, or the filesystem scheme is not configured (e.g. missing s3 credentials or wrong scheme).

Common situations: Typo in the location URI; missing HDFS permissions for the Presto user; S3/ABFS credentials not configured in the catalog properties; using a local-path URI on a cluster where only HDFS/object store is valid.

Related errors


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