t8y2/dbx · error

invalid Hive endpoint %q: %w

Error message

invalid Hive endpoint %q: %w

What it means

parseHiveEndpoint first tries net.SplitHostPort; when that succeeds, the extracted port string must parse as an integer via strconv.Atoi, otherwise the endpoint is rejected with this wrapped error. It enforces host:port endpoints from comma-separated endpoint lists.

Source

Thrown at agents/drivers/argo-go/config.go:396

		if trimmed := strings.TrimSpace(part); trimmed != "" {
			result = append(result, trimmed)
		}
	}
	return result
}

func parseEndpoint(value string, defaultPort int) (endpoint, error) {
	value = strings.TrimSpace(value)
	if value == "" {
		return endpoint{}, errors.New("Hive endpoint is empty")
	}
	host := value
	port := defaultPort
	if parsedHost, parsedPort, err := net.SplitHostPort(value); err == nil {
		host = parsedHost
		parsed, parseErr := strconv.Atoi(parsedPort)
		if parseErr != nil {
			return endpoint{}, fmt.Errorf("invalid Hive endpoint %q: %w", value, parseErr)
		}
		port = parsed
	} else if strings.Count(value, ":") == 1 {
		parts := strings.SplitN(value, ":", 2)
		parsed, parseErr := strconv.Atoi(parts[1])
		if parseErr != nil {
			return endpoint{}, fmt.Errorf("invalid Hive endpoint %q: %w", value, parseErr)
		}
		host = parts[0]
		port = parsed
	} else if strings.HasPrefix(value, "[") && strings.HasSuffix(value, "]") {
		host = strings.Trim(value, "[]")
	}
	if strings.TrimSpace(host) == "" || port <= 0 || port > 65535 {
		return endpoint{}, fmt.Errorf("invalid Hive endpoint %q", value)
	}
	return endpoint{Host: host, Port: port}, nil
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Replace the port with a numeric value 1-65535
  2. Fix unsubstituted template placeholders in the endpoint list
  3. Remove a redundant trailing colon or use bare hostname to take the default port
  4. Pre-validate endpoints with net.SplitHostPort plus strconv.Atoi before config load

Example fix

// before
endpoints: "host1:PORT1,host2:10000"
// after
endpoints: "host1:10000,host2:10000"
Defensive patterns

Strategy: validation

Validate before calling

for _, ep := range strings.Split(endpointsCSV, ",") {
    if _, _, err := net.SplitHostPort(ep); err == nil {
        if _, perr := strconv.Atoi(strings.TrimPrefix(ep, ep[:strings.LastIndex(ep, ":")+1])); perr != nil {
            return fmt.Errorf("endpoint %q port must be numeric", ep)
        }
    }
}

Type guard

func validEndpoint(v string) bool {
    h, p, err := net.SplitHostPort(v)
    if err != nil { return false }
    n, err := strconv.Atoi(p)
    return strings.TrimSpace(h) != "" && err == nil && n > 0 && n <= 65535
}

Try / catch

ep, err := parseHiveEndpoint(v)
if err != nil && strings.Contains(err.Error(), "invalid Hive endpoint") {
    return fmt.Errorf("endpoint %q rejected: %w", v, err)
}

Prevention

When it happens

Trigger: An endpoint value like 'host:notaport' where SplitHostPort succeeds (one colon) but the port substring fails Atoi.

Common situations: Typos ('host:10o000'), placeholder ports from templates ('host:PORT' unsubstituted), or service names ('host:http') instead of numbers.

Related errors


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