t8y2/dbx · error

no usable HiveServer2 nodes in ZooKeeper namespace %s: %s

Error message

no usable HiveServer2 nodes in ZooKeeper namespace %s: %s

What it means

Endpoints() found the namespace znode and could list children, but every candidate registration either failed to read (Get error) or failed to parse (unsupported registration format); nodeFailures collected those per-node reasons and this error surfaces them joined with '; '. The namespace exists but contains no usable HiveServer2 endpoint.

Source

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

			}
			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"),
		}
	}
	return []string{zooKeeperPath(namespace)}
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Read the nodeFailures list in the message; fix the per-node cause (ACL/auth, deleted node, malformed payload).
  2. Enable ZooKeeper auth (authScheme + auth) if the znodes are access-controlled.
  3. Verify each registered server is healthy; stale ephemeral nodes mean servers died — restart HiveServer2 instances.
  4. Check the payload format published by your HiveServer2 version; upgrade the driver or reconfigure the server's published config keys (serverUri/hiveserver2Uri/server_uri).
Defensive patterns

Strategy: retry

Validate before calling

// Probe a registration child before relying on discovery
conn, _, _ := zk.Connect([]string{"zk1:2181"}, 5*time.Second)
if auth != "" { conn.AddAuth("digest", []byte(auth)) }
children, _, err := conn.Children("/hiveserver2/instances")
if err != nil || len(children) == 0 {
    fmt.Println("namespace unusable:", err)
}
conn.Close()

Try / catch

endpoints, err := discovery.Endpoints(ctx, rejected)
if err != nil {
    if strings.Contains(err.Error(), "no usable HiveServer2 nodes") {
        // nodeFailures are embedded; retry after servers re-register
        time.Sleep(2 * time.Second)
        endpoints, err = discovery.Endpoints(ctx, rejected)
    }
    if err != nil { return err }
}

Prevention

When it happens

Trigger: Calling Endpoints when the namespace path lists children but each child read from path+'/'+child failed (e.g. ephemeral nodes deleted mid-read, ACLs denying Get) or each child's payload could not be parsed as a known HiveServer2 registration (bad JSON, missing serverUri keys, unparsable host:port).

Common situations: HiveServer2 nodes are crashing so their ephemeral znodes vanish during discovery; SASL-protected znodes unreadable by an unauthenticated client; a non-Hive service (or old Hive version) publishing znodes in the same namespace in an unexpected format.

Related errors


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