t8y2/dbx · error

Hive host is required

Error message

Hive host is required

What it means

The Hive connection builder requires at least one server endpoint, and none was resolved from the connection string, parameters, or defaults. finalizeKerberosConfig succeeded, but config.Endpoints ended up empty, so there is no host to connect to. This is the driver's 'no host configured' guard.

Source

Thrown at agents/drivers/hive-go/config.go:254

				return connectionConfig{}, endpointErr
			}
			config.Endpoints = append(config.Endpoints, parsedEndpoint)
		}
	} else {
		config.Endpoints = parsed.endpoints
	}
	applyOpenSessionVariables(&config, values, hiveConfs, hiveVars)
	if err := applyDelegationToken(&config, values); err != nil {
		return connectionConfig{}, err
	}
	applyKerberosJavaOptions(&config.Kerberos, params.AgentJavaOptions)
	applyZooKeeperKerberosJavaOptions(&config.ZooKeeperKerberos, params.AgentJavaOptions)
	applyKerberosEnvironment(&config.Kerberos)
	if err := finalizeKerberosConfig(&config); err != nil {
		return connectionConfig{}, err
	}
	if len(config.Endpoints) == 0 {
		return connectionConfig{}, errors.New("Hive host is required")
	}

	tlsConfig, err := buildTLSConfig(params, values, config.Endpoints[0].Host)
	if err != nil {
		return connectionConfig{}, err
	}
	config.TLSConfig = tlsConfig
	zooKeeperTLSConfig, err := buildZooKeeperTLSConfig(values)
	if err != nil {
		return connectionConfig{}, err
	}
	config.ZooKeeperTLSConfig = zooKeeperTLSConfig
	return config, nil
}

func isZooKeeperDiscovery(mode string) bool {
	return strings.EqualFold(mode, "zookeeper") || strings.EqualFold(mode, "zookeeperha")
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Set the host in the connection string (e.g. jdbc:hive2://hivehost:10000/default) or the host parameter.
  2. Verify the environment variable or config file supplying the host is populated in the runtime environment.
  3. When constructing the config in code, append at least one endpoint with host (and port, or rely on the default port).

Example fix

// before
url := "jdbc:hive2:///default"
// after
url := "jdbc:hive2://hive01.example.com:10000/default"
Defensive patterns

Strategy: validation

Validate before calling

func requireHiveHost(cfg map[string]string) error {
    if strings.TrimSpace(cfg["host"]) == "" {
        return errors.New("hive host must be set")
    }
    return nil
}

Type guard

func hasEndpoint(cfg *connectionConfig) bool { return len(cfg.Endpoints) > 0 }

Try / catch

cfg, err := buildConfig(params)
if err != nil && strings.Contains(err.Error(), "Hive host is required") {
    return fmt.Errorf("config error: supply host via DSN or host param: %w", err)
}

Prevention

When it happens

Trigger: Calling the open/connect path with a config missing the host/hosts value; passing an empty or whitespace-only 'host' parameter; building connectionConfig programmatically without appending to Endpoints.

Common situations: DSN like 'jdbc:hive2://' with nothing after it, environment-driven configs where the HOST env var is unset, copy-pasted config structs with the host field left blank.

Related errors


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