{"record":{"id":"3c8e0008e30953f1","repo":"prestodb/presto","slug":"invalid-schema-property","errorCode":"INVALID_SCHEMA_PROPERTY","errorMessage":"Invalid location URI: ","messagePattern":"Invalid location URI: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java","lineNumber":1009,"sourceCode":"     * Returns a TupleDomain of constraints that is suitable for Explain (Type IO)\n     * <p>\n     * Only Hive partition columns that are used in IO planning.\n     */\n    @Override\n    public TupleDomain<ColumnHandle> toExplainIOConstraints(ConnectorSession session, ConnectorTableHandle tableHandle, TupleDomain<ColumnHandle> constraints)\n    {\n        return constraints.transform(columnHandle -> ((HiveColumnHandle) columnHandle).isPartitionKey() ? columnHandle : null);\n    }\n\n    @Override\n    public void createSchema(ConnectorSession session, String schemaName, Map<String, Object> properties)\n    {\n        Optional<String> location = SchemaProperties.getLocation(properties).map(locationUri -> {\n            try {\n                hdfsEnvironment.getFileSystem(new HdfsContext(session, schemaName), new Path(locationUri));\n            }\n            catch (IOException e) {\n                throw new PrestoException(INVALID_SCHEMA_PROPERTY, \"Invalid location URI: \" + locationUri, e);\n            }\n            return locationUri;\n        });\n\n        Database database = Database.builder()\n                .setDatabaseName(schemaName)\n                .setLocation(location)\n                .setOwnerType(USER)\n                .setOwnerName(session.getUser())\n                .build();\n\n        metastore.createDatabase(getMetastoreContext(session), database);\n    }\n\n    @Override\n    public void dropSchema(ConnectorSession session, String schemaName)\n    {\n        // basic sanity check to provide a better error message","sourceCodeStart":991,"sourceCodeEnd":1027,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java#L991-L1027","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Fix the location URI in the CREATE SCHEMA statement (correct scheme and host, e.g. hdfs://namenode:8020/path)","Verify the URI is reachable with the same credentials: run hdfs dfs -ls <uri> or equivalent","Check presto HdfsConfiguration (core-site.xml/hive.properties fs.location or native filesystem settings) supports the scheme","Check HDFS permissions/ACLs for the Presto service user on the target path"],"exampleFix":"// before\nCREATE SCHEMA web WITH (location = 'hdfs:/data/web');\n// after\nCREATE SCHEMA web WITH (location = 'hdfs://namenode:8020/data/web');","handlingStrategy":"validation","validationCode":"// validate before CREATE SCHEMA\nPath path = new Path(locationUri);\nConfiguration conf = new Configuration();\nFileSystem fs = path.getFileSystem(conf);\nfs.exists(path); // throws IOException if URI/scheme invalid or unreachable","typeGuard":"boolean isValidLocationUri(String uri) {\n    try { new Path(uri); return uri.matches(\"^[a-z][a-z0-9+.-]*://.+\"); }\n    catch (IllegalArgumentException e) { return false; }\n}","tryCatchPattern":"try {\n    connector.createSchema(session, schemaName, properties);\n} catch (PrestoException e) {\n    if (e.getErrorCode().getCode() == StandardErrorCode.INVALID_SCHEMA_PROPERTY.code()) {\n        // log e.getCause() (IOException) to see actual HDFS failure; fix URI or credentials\n    } else { throw e; }\n}","preventionTips":["Use fully qualified URIs (hdfs://namenode:port/path) rather than bare paths","Pre-test the location with hdfs dfs -ls or an equivalent listing under the same user","Confirm the storage scheme (s3a, abfs, etc.) is configured in the Presto HDFS config"],"tags":["hive","hdfs","schema","location-uri"],"backgroundTag":"invalid-location-uri","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"}