{"record":{"id":"d54652e0c42990a2","repo":"t8y2/dbx","slug":"hiveserver2-zookeeper-namespace-not-found-tried","errorCode":null,"errorMessage":"HiveServer2 ZooKeeper namespace not found; tried %s","messagePattern":"HiveServer2 ZooKeeper namespace not found; tried (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/argo-go/discovery.go","lineNumber":155,"sourceCode":"\t\t\t\t}\n\t\t\t\tnodeFailures = append(nodeFailures, fmt.Sprintf(\"%s/%s: %v\", path, child, dataErr))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvalue, parseErr := parseHiveServerRegistration(child, data)\n\t\t\tif parseErr == nil {\n\t\t\t\tresolved = append(resolved, value)\n\t\t\t} else {\n\t\t\t\tnodeFailures = append(nodeFailures, fmt.Sprintf(\"%s/%s: %v\", path, child, parseErr))\n\t\t\t}\n\t\t}\n\t\tif len(resolved) > 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\tresolved = shuffledEndpoints(uniqueEndpoints(resolved), rejected)\n\tif len(resolved) == 0 {\n\t\tif listedPath == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"HiveServer2 ZooKeeper namespace not found; tried %s\", strings.Join(discovery.paths(), \", \"))\n\t\t}\n\t\tif len(nodeFailures) > 0 {\n\t\t\treturn nil, fmt.Errorf(\"no usable HiveServer2 nodes in ZooKeeper namespace %s: %s\", listedPath, strings.Join(nodeFailures, \"; \"))\n\t\t}\n\t\treturn nil, fmt.Errorf(\"no available HiveServer2 nodes in ZooKeeper namespace %s\", listedPath)\n\t}\n\treturn resolved, nil\n}\n\nfunc (discovery *zooKeeperDiscovery) paths() []string {\n\tnamespace := strings.Trim(discovery.namespace, \"/\")\n\tif strings.EqualFold(discovery.discoveryMode, \"zookeeperha\") {\n\t\treturn []string{\n\t\t\tzooKeeperPath(namespace, \"instances\"),\n\t\t\tzooKeeperPath(namespace+\"-unsecure\", \"instances\"),\n\t\t\tzooKeeperPath(namespace+\"-sasl\", \"instances\"),\n\t\t}\n\t}","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/argo-go/discovery.go#L137-L173","documentation":"Endpoints() walked every candidate ZooKeeper namespace path and none of them exist (all returned zk.ErrNoNode), so no HiveServer2 instances could be discovered. It is thrown when listedPath remains empty after the path loop. The message enumerates the exact paths tried to help diagnose namespace misconfiguration.","triggerScenarios":"connection.Children(path) returned zk.ErrNoNode for every path in discovery.paths() — in zookeeperha mode that is <ns>/instances, <ns>-unsecure/instances, <ns>-sasl/instances; in plain zookeeper mode just /<ns>.","commonSituations":"Wrong zooKeeperNamespace in the connection config; HiveServer2 not configured to publish to ZooKeeper (hive.server2.support.dynamic.service.discovery=false); namespace exists but without the /instances suffix expected in zookeeperha mode; different ZK cluster than the one Hive publishes to.","solutions":["Check the namespace znode with zkCli: ls /<namespace> and confirm HiveServer2 children exist; correct the zooKeeperNamespace config value.","If using zookeeperha mode, confirm the znode layout is <ns>/instances; if Hive publishes directly under the namespace, use plain zookeeper mode.","Verify serviceDiscoveryMode=zookeeper and that HiveServer2 has dynamic service discovery enabled and is registered to the same ensemble.","Verify zooKeeper server list points at the ensemble HiveServer2 actually publishes to."],"exampleFix":"// before\nserviceDiscoveryMode=zookeeperha, zooKeeperNamespace=hs2   // expects /hs2/instances\n// after — znode layout is flat\nserviceDiscoveryMode=zookeeper, zooKeeperNamespace=hs2","handlingStrategy":"validation","validationCode":"// preflight: confirm at least one candidate path exists\nconn, _, _ := zk.Connect(zkHosts, 5*time.Second)\nfor _, p := range []string{\"/\"+ns, \"/\"+ns+\"/instances\"} {\n    if _, _, err := conn.Children(p); err == nil {\n        conn.Close(); return nil\n    }\n}\nconn.Close()\nreturn fmt.Errorf(\"no ZooKeeper namespace found for %s\", ns)","typeGuard":null,"tryCatchPattern":"eps, err := discovery.Endpoints(ctx, nil)\nif err != nil && strings.Contains(err.Error(), \"namespace not found\") {\n    // configuration problem: surface config values for the operator\n    return fmt.Errorf(\"check serviceDiscoveryMode/zooKeeperNamespace (mode=%s ns=%s): %w\", mode, ns, err)\n}","preventionTips":["Verify with zkCli that HiveServer2 publishes children under the configured namespace.","Enable hive.server2.support.dynamic.service.discovery on HiveServer2.","Use zookeeperha mode only when znodes follow <ns>/instances layout.","Point the config at the same ZK ensemble HiveServer2 registers with."],"tags":["zookeeper","service-discovery","configuration","go"],"backgroundTag":"zookeeper-node-not-found","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}