t8y2/dbx · error

HiveServer2 ZooKeeper namespace not found; tried %s

Error message

HiveServer2 ZooKeeper namespace not found; tried %s

What it means

Endpoints() in the ZooKeeper service-discovery layer probes each configured HiveServer2 namespace path in ZooKeeper. If none of the candidate znode paths exists (every Children() call returned ErrNoNode), it cannot resolve any HiveServer2 instance and throws this error listing all the paths it attempted. It means the configured namespace does not match anything registered in the ensemble.

Source

Thrown at agents/drivers/hive-go/discovery.go:155

				}
				nodeFailures = append(nodeFailures, fmt.Sprintf("%s/%s: %v", path, child, dataErr))
				continue
			}
			value, parseErr := parseHiveServerRegistration(child, data)
			if parseErr == nil {
				resolved = append(resolved, value)
			} else {
				nodeFailures = append(nodeFailures, fmt.Sprintf("%s/%s: %v", path, child, parseErr))
			}
		}
		if len(resolved) > 0 {
			break
		}
	}
	resolved = shuffledEndpoints(uniqueEndpoints(resolved), rejected)
	if len(resolved) == 0 {
		if listedPath == "" {
			return nil, fmt.Errorf("HiveServer2 ZooKeeper namespace not found; tried %s", strings.Join(discovery.paths(), ", "))
		}
		if len(nodeFailures) > 0 {
			return nil, fmt.Errorf("no usable HiveServer2 nodes in ZooKeeper namespace %s: %s", listedPath, strings.Join(nodeFailures, "; "))
		}
		return nil, fmt.Errorf("no available HiveServer2 nodes in ZooKeeper namespace %s", listedPath)
	}
	return resolved, nil
}

func (discovery *zooKeeperDiscovery) paths() []string {
	namespace := strings.Trim(discovery.namespace, "/")
	if strings.EqualFold(discovery.discoveryMode, "zookeeperha") {
		return []string{
			zooKeeperPath(namespace, "instances"),
			zooKeeperPath(namespace+"-unsecure", "instances"),
			zooKeeperPath(namespace+"-sasl", "instances"),
		}
	}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify the namespace matches the value HiveServer2 publishes (hive.zookeeper.namespace / zookeeper namespace in server config) and correct the client config.
  2. Log into ZooKeeper (zkCli) and run ls on the candidate paths to confirm where HiveServer2 znodes actually live.
  3. Confirm HiveServer2 is running with dynamic service discovery enabled so it registers znodes under the namespace.
  4. Check whether the servers use a HA discovery mode; adjust discoveryMode so the -unsecure/-sasl candidate paths match your deployment.

Example fix

// before
discovery.namespace = "hiveserver2-dev"
// after (match hive.zookeeper.namespace on the servers)
discovery.namespace = "hiveserver2"
Defensive patterns

Strategy: fallback

Validate before calling

// Before connecting, verify the namespace exists
conn, _, _ := zk.Connect([]string{"zk1:2181"}, 5*time.Second)
paths := []string{"/hiveserver2", "/hiveserver2/instances"}
for _, p := range paths {
    if _, _, err := conn.Children(p); err == nil {
        fmt.Println("namespace present:", p)
        break
    }
}
conn.Close()

Try / catch

endpoints, err := discovery.Endpoints(ctx, rejected)
if err != nil {
    if strings.Contains(err.Error(), "namespace not found") {
        // fall back to a statically configured HiveServer2 host list
        endpoints = staticEndpoints
    } else {
        return err
    }
}

Prevention

When it happens

Trigger: Calling Endpoints (via the Hive driver's discovery path) when every candidate path under the configured namespace is missing in ZooKeeper: wrong namespace in the connection config, HiveServer2 never registered (not started, or service discovery disabled on the servers), or zookeeperHA mode where none of /<ns>/instances, /<ns>-unsecure/instances, /<ns>-sasl/instances exist.

Common situations: Typos or trailing-slash confusion in the ZooKeeper namespace; pointing at the wrong ensemble (dev vs prod); HiveServer2 configured with hive.server2.support.dynamic.service.discovery=false so nothing is published; HA mode expecting -unsecure/-sasl suffixed paths that the server version does not create.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/e8468c527c1328d9. Report an issue: GitHub.