{"record":{"id":"5dd3ebfaa8327a4e","repo":"prestodb/presto","slug":"zookeeper-error","errorCode":"ZOOKEEPER_ERROR","errorMessage":"ZK error checking metadata root","messagePattern":"ZK error checking metadata root","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"presto-accumulo/src/main/java/com/facebook/presto/accumulo/metadata/ZooKeeperMetadataManager.java","lineNumber":74,"sourceCode":"        JsonObjectMapperProvider objectMapperProvider = new JsonObjectMapperProvider();\n        objectMapperProvider.setJsonDeserializers(ImmutableMap.of(Type.class, new AccumuloModule.TypeDeserializer(typeManager)));\n        mapper = objectMapperProvider.get();\n\n        String zkMetadataRoot = config.getZkMetadataRoot();\n        String zookeepers = config.getZooKeepers();\n\n        // Create the connection to ZooKeeper to check if the metadata root exists\n        CuratorFramework checkRoot = CuratorFrameworkFactory.newClient(zookeepers, new RetryForever(1000));\n        checkRoot.start();\n\n        try {\n            // If the metadata root does not exist, create it\n            if (checkRoot.checkExists().forPath(zkMetadataRoot) == null) {\n                checkRoot.create().forPath(zkMetadataRoot);\n            }\n        }\n        catch (Exception e) {\n            throw new PrestoException(ZOOKEEPER_ERROR, \"ZK error checking metadata root\", e);\n        }\n        checkRoot.close();\n\n        // Create the curator client framework to use for metadata management, set at the ZK root\n        curator = CuratorFrameworkFactory.newClient(zookeepers + zkMetadataRoot, new RetryForever(1000));\n        curator.start();\n\n        try {\n            // Create default schema should it not exist\n            if (curator.checkExists().forPath(\"/\" + DEFAULT_SCHEMA) == null) {\n                curator.create().forPath(\"/\" + DEFAULT_SCHEMA);\n            }\n        }\n        catch (Exception e) {\n            throw new PrestoException(ZOOKEEPER_ERROR, \"ZK error checking/creating default schema\", e);\n        }\n    }\n","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-accumulo/src/main/java/com/facebook/presto/accumulo/metadata/ZooKeeperMetadataManager.java#L56-L92","documentation":"During ZooKeeperMetadataManager initialization, a Curator client checks whether the Presto metadata root znode exists and creates it if missing. Any exception from checkExists()/create() is wrapped as ZOOKEEPER_ERROR. The connector cannot set up its metadata store in ZooKeeper.","triggerScenarios":"Constructor-time checkExists().forPath(zkMetadataRoot) or create().forPath(zkMetadataRoot) throwing because ZooKeeper is unreachable, the chroot path's parents don't exist, or the client lacks create permission on the root.","commonSituations":"ZooKeeper quorum down or wrong host:port in catalog properties; zk metadata root configured under a chroot (e.g. /presto-accumulo) whose znode was never created; Kerberos/SASL ACLs denying access; network partition between Presto and ZooKeeper.","solutions":["Verify ZooKeeper is reachable: check zookeepers host:port in catalog properties and test with a ZK client (e.g. zkCli.sh ls /)","Create missing parent/chroot znodes manually (zkCli.sh create /presto-accumulo) or use a root path whose parents exist","Check ZooKeeper ACLs/permissions allow the Presto user to create nodes at the metadata root","Inspect the wrapped cause in the Presto log for connection-refused vs auth-failure specifics"],"exampleFix":"// before\nzk.metadata.root=/presto-accumulo   // chroot never created in ZK\n// after\n// zkCli.sh -server zk1:2181 create /presto-accumulo\nzk.metadata.root=/presto-accumulo","handlingStrategy":"validation","validationCode":"// before starting Presto, verify ZK reachability and root writability\ntry (CuratorFramework c = CuratorFrameworkFactory.newClient(zkHosts, new RetryForever(1000))) {\n    c.start();\n    c.blockUntilConnected(30, TimeUnit.SECONDS);\n    if (c.checkExists().forPath(\"/presto-accumulo\") == null) {\n        c.create().forPath(\"/presto-accumulo\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    // initialize connector / run query\n} catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"ZOOKEEPER_ERROR\")) {\n        // verify ZK quorum, chroot znodes, and ACLs, then restart/retry\n    }\n    throw e;\n}","preventionTips":["Create the chroot znode (e.g. /presto-accumulo) in ZooKeeper before pointing the catalog at it","Monitor the ZooKeeper quorum and network path from coordinator/workers","Ensure ZK ACLs allow the Presto user to create/read nodes under the metadata root","Test the catalog with a simple SHOW SCHEMAS after deployment"],"tags":["zookeeper","accumulo","connection","startup"],"backgroundTag":"zookeeper-connection-failure","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"}