{"record":{"id":"bbf9ef11918dfd7a","repo":"prestodb/presto","slug":"hive-filesystem-error-bbf9ef","errorCode":"HIVE_FILESYSTEM_ERROR","errorMessage":"Failed checking path: ","messagePattern":"Failed checking path: ","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/HiveWriteUtils.java","lineNumber":452,"sourceCode":"                throw new PrestoException(HIVE_DATABASE_LOCATION_ERROR, format(\"Database '%s' location is not a directory: %s\", schemaName, databasePath));\n            }\n        }\n\n        return new Path(databasePath, tableName);\n    }\n\n    private static Database getDatabase(ConnectorIdentity identity, MetastoreContext metastoreContext, SemiTransactionalHiveMetastore metastore, String database)\n    {\n        return metastore.getDatabase(metastoreContext, database).orElseThrow(() -> new SchemaNotFoundException(database));\n    }\n\n    public static boolean isS3FileSystem(HdfsContext context, HdfsEnvironment hdfsEnvironment, Path path)\n    {\n        try {\n            return getRawFileSystem(hdfsEnvironment.getFileSystem(context, path)) instanceof PrestoS3FileSystem;\n        }\n        catch (IOException e) {\n            throw new PrestoException(HIVE_FILESYSTEM_ERROR, \"Failed checking path: \" + path, e);\n        }\n    }\n\n    public static boolean isViewFileSystem(HdfsContext context, HdfsEnvironment hdfsEnvironment, Path path)\n    {\n        try {\n            return getRawFileSystem(hdfsEnvironment.getFileSystem(context, path)) instanceof ViewFileSystem;\n        }\n        catch (IOException e) {\n            throw new PrestoException(HIVE_FILESYSTEM_ERROR, \"Failed checking path: \" + path, e);\n        }\n    }\n\n    private static FileSystem getRawFileSystem(FileSystem fileSystem)\n    {\n        if (fileSystem instanceof HadoopExtendedFileSystem) {\n            return getRawFileSystem(((HadoopExtendedFileSystem) fileSystem).getRawFileSystem());\n        }","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/HiveWriteUtils.java#L434-L470","documentation":"isS3FileSystem obtains a Hadoop FileSystem for the given path to test whether the underlying (raw) filesystem is PrestoS3FileSystem; an IOException from the Hadoop filesystem layer is wrapped in HIVE_FILESYSTEM_ERROR with the path appended. This check is part of default-location validation and temporary-path creation.","triggerScenarios":"Any call path (e.g. getTableDefaultLocation, CREATE TABLE location validation) where opening the FileSystem for the database path fails — NameNode unreachable, kerberos/auth failure, unknown URI scheme, network timeout.","commonSituations":"HDFS NameNode down or in safe mode; wrong URI scheme (no handler for scheme); expired/invalid Kerberos token or missing credentials; network partition to storage.","solutions":["Verify the storage cluster is reachable and the NameNode/endpoint is healthy (hdfs dfs -ls <path> from a worker)","Check filesystem URI scheme is correct and supported (hdfs://, s3a/s3n, viewfs) in the database location","Review worker logs for the wrapped IOException cause (auth, DNS, timeout) and fix credentials/network accordingly"],"exampleFix":"// before\nlocation: hdfs://wrongnn:9000/warehouse/db.db -- NameNode unreachable\n// after\nALTER DATABASE db SET LOCATION 'hdfs://correctnn:9000/warehouse/db.db';","handlingStrategy":"retry","validationCode":"Path p = new Path(dbLocation);\ntry (FileSystem fs = FileSystem.get(p.toUri(), conf)) { fs.getUri(); }\ncatch (IOException e) { throw new IllegalStateException(\"Filesystem unreachable for \" + p, e); }","typeGuard":null,"tryCatchPattern":"try {\n    createTable(schema, ...);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == HIVE_FILESYSTEM_ERROR.toErrorCode() && e.getCause() instanceof IOException) {\n        // check NN health/auth, back off, retry\n    } else throw e;\n}","preventionTips":["Monitor NameNode/endpoint health from worker hosts","Keep keytabs/credentials fresh to avoid auth IOExceptions","Use stable, correct scheme://authority URIs in database locations"],"tags":["hive","hdfs","io","filesystem"],"backgroundTag":"filesystem-io-error","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"}