t8y2/dbx · error

Hive discovery returned no endpoints

Error message

Hive discovery returned no endpoints

What it means

This error is returned by discoveryConnector.Connect when its Hive ZooKeeper discovery loop produced zero endpoint failures but also zero usable endpoints. It means the discovery process finished without ever attempting or failing a candidate, so no endpoint could be dialed and there is nothing to fail over to.

Source

Thrown at agents/drivers/hive-go/connector.go:165

					return connection, nil
				}
				rejected[target.address()] = true
				failures = append(failures, fmt.Sprintf("attempt %d %s: %v", attempt+1, target.address(), connectErr))
			}
			break
		}
		if attempt+1 < connector.retries && connector.retryInterval > 0 {
			timer := time.NewTimer(connector.retryInterval)
			select {
			case <-ctx.Done():
				timer.Stop()
				return nil, ctx.Err()
			case <-timer.C:
			}
		}
	}
	if len(failures) == 0 {
		return nil, errors.New("Hive discovery returned no endpoints")
	}
	return nil, fmt.Errorf("all HiveServer2 endpoints failed: %s", strings.Join(failures, "; "))
}

func (connector *discoveryConnector) Driver() driver.Driver {
	return connector.driver
}

func openHiveDatabase(config connectionConfig) *sql.DB {
	database := sql.OpenDB(newDiscoveryConnector(config))
	database.SetMaxOpenConns(1)
	database.SetMaxIdleConns(1)
	return database
}

func normalizeHiveAuth(value string) string {
	normalized := strings.ToUpper(strings.TrimSpace(value))
	switch normalized {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Verify hive.server2.support.dynamic.service.discovery=true and zookeeper znode (default /hiveserver2) on the servers
  2. Confirm the zkQuorum string is correct and reachable, and that the configured discovery path contains children
  3. Log the candidate list from Endpoints() before Connect; if empty, fix discovery config rather than Connect
  4. Enable ZooKeeper auth so hidden/ACL-protected nodes are visible

Example fix

// before
connector, _ := NewDiscoveryConnector("zk-bad-host:2181", "", driver)
connector.Connect(ctx)
// after
connector, _ := NewDiscoveryConnector("zk1:2181,zk2:2181", "/hiveserver2", driver)
// ensure servers registered before connecting
Defensive patterns

Strategy: retry

Validate before calling

// before connecting, check discovery yields candidates
endpoints, err := discovery.Endpoints(ctx)
if err != nil { return err }
if len(endpoints) == 0 {
    return fmt.Errorf("no HiveServer2 registrations under %s; verify discovery config", discoveryPath)
}

Try / catch

if err := connector.Connect(ctx); err != nil {
    if err.Error() == "Hive discovery returned no endpoints" {
        // re-check znode path / registrations, then retry with backoff
        return retryWithBackoff(ctx, connector.Connect)
    }
    return err
}

Prevention

When it happens

Trigger: Calling Connect on a discoveryConnector whose ZooKeeper discovery returned an empty endpoint list with no recorded dial failures — e.g. Endpoints() resolved zero registration nodes before the retry loop started.

Common situations: Empty or wrong ZooKeeper znode path (hive.server2.support.dynamic.service.discovery=false so servers never register), zkQuorum pointing at a cluster that has no HiveServer2 registrations, or ACLs silently filtering all children.

Related errors


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