t8y2/dbx · error

%s must include a host and a port between 1 and 65535

Error message

%s must include a host and a port between 1 and 65535

What it means

endpointOverride validates an endpoint override config object (e.g. tls endpoint or management endpoint) and requires a non-empty host plus a port in [1, 65535]; otherwise it returns this error naming the config key. It prevents building invalid dial/management addresses.

Source

Thrown at agents/drivers/rabbitmq/helpers.go:263

	if properties == nil {
		return 0, false
	}
	value := integerOrNull(properties, key)
	if value == nil {
		return 0, false
	}
	return *value, true
}

func endpointOverride(config jsonObject, key string) (*address, error) {
	override := objectOrNil(config, key)
	if override == nil {
		return nil, nil
	}
	host := strings.TrimSpace(stringOrEmpty(override, "host"))
	port := integerOrNull(override, "port")
	if host == "" || port == nil || *port < 1 || *port > 65535 {
		return nil, fmt.Errorf("%s must include a host and a port between 1 and 65535", key)
	}
	return &address{Host: host, Port: *port}, nil
}

func boolProperty(config jsonObject, key string) bool {
	return boolOrDefault(objectOrNil(config, "properties"), key, false)
}

func durationMilliseconds(object jsonObject, key string, fallback time.Duration) time.Duration {
	value := integerOrNull(object, key)
	if value == nil {
		return fallback
	}
	return time.Duration(*value) * time.Millisecond
}

func argumentValue(value any) any {
	switch typed := value.(type) {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Add a valid host string to the override object under the reported key
  2. Add an integer port between 1 and 65535 (not a string)
  3. Fix the key names to exactly "host" and "port"
  4. Validate the config file section before loading it into the connection config

Example fix

// before
"management": {"host": "mgmt.example.com", "port": "15672"}
// after
"management": {"host": "mgmt.example.com", "port": 15672}
Defensive patterns

Strategy: validation

Validate before calling

func validEndpoint(cfg map[string]any, key string) error {
    o, ok := cfg[key].(map[string]any)
    if !ok { return fmt.Errorf("%s override missing", key) }
    host, _ := o["host"].(string)
    port, ok := o["port"].(int)
    if strings.TrimSpace(host) == "" || !ok || port < 1 || port > 65535 {
        return fmt.Errorf("%s must include host and integer port 1-65535", key)
    }
    return nil
}

Type guard

func isValidEndpoint(o map[string]any) bool {
    h, ok := o["host"].(string)
    if !ok || strings.TrimSpace(h) == "" { return false }
    p, ok := o["port"].(int)
    return ok && p >= 1 && p <= 65535
}

Try / catch

addr, err := endpointOverride(config, "management")
if err != nil {
    return fmt.Errorf("config error in %q: %w", "management", err)
}

Prevention

When it happens

Trigger: Calling endpointOverride (via dialAddress or managementRequestOnce) with a config where the override map under key (e.g. "tls" or "management") is missing "host", has an empty/whitespace host, lacks "port", or has a port outside 1–65535.

Common situations: Config typo ("hostname" instead of "host"); port given as string instead of integer; port 0 or >65535; YAML/JSON section omitted values.

Related errors


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