{"record":{"id":"74543a99f8032a6c","repo":"apache/dolphinscheduler","slug":"zookeeper-get-data-error","errorCode":null,"errorMessage":"zookeeper get data error","messagePattern":"zookeeper get data error","errorType":"exception","errorClass":"RegistryException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java","lineNumber":158,"sourceCode":"\n    @Override\n    public void subscribe(final String path, final SubscribeListener listener) {\n        final TreeCache treeCache = treeCacheMap.computeIfAbsent(path, $ -> new TreeCache(client, path));\n        treeCache.getListenable().addListener(new ZookeeperTreeCacheListenerAdapter(path, listener));\n        try {\n            treeCache.start();\n        } catch (Exception e) {\n            treeCacheMap.remove(path);\n            throw new RegistryException(\"Failed to subscribe listener for key: \" + path, e);\n        }\n    }\n\n    @Override\n    public String get(String key) {\n        try {\n            return new String(client.getData().forPath(key), StandardCharsets.UTF_8);\n        } catch (Exception e) {\n            throw new RegistryException(\"zookeeper get data error\", e);\n        }\n    }\n\n    @Override\n    public boolean exists(String key) {\n        try {\n            return null != client.checkExists().forPath(key);\n        } catch (Exception e) {\n            throw new RegistryException(\"zookeeper check key is existed error\", e);\n        }\n    }\n\n    @Override\n    public void put(String key, String value, boolean deleteOnDisconnect) {\n        final CreateMode mode = deleteOnDisconnect ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT;\n\n        try {\n            client.create()","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L140-L176","documentation":"ZookeeperRegistry.get() reads the data of a ZNode via Curator's client.getData().forPath(key) and wraps any exception in a RegistryException with the generic message 'zookeeper get data error'. It is thrown for connectivity problems, missing nodes (NoNode), and ACL/authorization failures alike — the actual KeeperException is only available as the cause.","triggerScenarios":"Calling get(key) when the key does not exist in ZooKeeper (KeeperException.NoNode), when the session has expired or connection is lost, when the path is malformed (empty/relative path), or when ACLs deny read access.","commonSituations":"Reading a process/task state node that another component already deleted (race with delete()); ZooKeeper restarted or unreachable so the client has no live session; key typo or path-prefix mismatch between writer and reader components; permissions changed on the znode.","solutions":["Call registry.exists(key) before get() to handle the missing-node case gracefully","Check the cause KeeperException code: NoNode means the key is gone (handle as absent), CONNECTIONLOSS/SESSIONEXPIRED means retry after session recovery","Verify ZooKeeper connectivity and registry.zookeeper.connect-string configuration","Confirm reader and writer build the same key path (same prefix, no typo)","Check znode ACLs allow the client to read"],"exampleFix":"// before\nString value = registry.get(\"/process/\" + id);\n// after\nString value = registry.exists(\"/process/\" + id) ? registry.get(\"/process/\" + id) : null;","handlingStrategy":"try-catch","validationCode":"// guard against missing key\nif (!registry.exists(key)) { return null; }","typeGuard":null,"tryCatchPattern":"try {\n    return registry.get(key);\n} catch (RegistryException e) {\n    if (e.getCause() instanceof KeeperException.NoNodeException) {\n        return null; // treat as absent\n    }\n    throw e; // connectivity/ACL problems are real failures\n}","preventionTips":["Always pair get() with exists() or catch NoNodeException via the cause","Ensure writer and reader construct identical key paths from the same constants","Handle race conditions where another component deletes the node between exists() and get()","Keep UTF-8 encoding assumptions consistent with put()"],"tags":["zookeeper","curator","registry","read-failed"],"backgroundTag":"resource-not-found","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}