{"record":{"id":"3a9d0dfcaceb92d8","repo":"t8y2/dbx","slug":"s-must-include-a-host-and-a-port-between-1-and-65","errorCode":null,"errorMessage":"%s must include a host and a port between 1 and 65535","messagePattern":"(.+?) must include a host and a port between 1 and 65535","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/helpers.go","lineNumber":263,"sourceCode":"\tif properties == nil {\n\t\treturn 0, false\n\t}\n\tvalue := integerOrNull(properties, key)\n\tif value == nil {\n\t\treturn 0, false\n\t}\n\treturn *value, true\n}\n\nfunc endpointOverride(config jsonObject, key string) (*address, error) {\n\toverride := objectOrNil(config, key)\n\tif override == nil {\n\t\treturn nil, nil\n\t}\n\thost := strings.TrimSpace(stringOrEmpty(override, \"host\"))\n\tport := integerOrNull(override, \"port\")\n\tif host == \"\" || port == nil || *port < 1 || *port > 65535 {\n\t\treturn nil, fmt.Errorf(\"%s must include a host and a port between 1 and 65535\", key)\n\t}\n\treturn &address{Host: host, Port: *port}, nil\n}\n\nfunc boolProperty(config jsonObject, key string) bool {\n\treturn boolOrDefault(objectOrNil(config, \"properties\"), key, false)\n}\n\nfunc durationMilliseconds(object jsonObject, key string, fallback time.Duration) time.Duration {\n\tvalue := integerOrNull(object, key)\n\tif value == nil {\n\t\treturn fallback\n\t}\n\treturn time.Duration(*value) * time.Millisecond\n}\n\nfunc argumentValue(value any) any {\n\tswitch typed := value.(type) {","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/helpers.go#L245-L281","documentation":"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.","triggerScenarios":"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.","commonSituations":"Config typo (\"hostname\" instead of \"host\"); port given as string instead of integer; port 0 or >65535; YAML/JSON section omitted values.","solutions":["Add a valid host string to the override object under the reported key","Add an integer port between 1 and 65535 (not a string)","Fix the key names to exactly \"host\" and \"port\"","Validate the config file section before loading it into the connection config"],"exampleFix":"// before\n\"management\": {\"host\": \"mgmt.example.com\", \"port\": \"15672\"}\n// after\n\"management\": {\"host\": \"mgmt.example.com\", \"port\": 15672}","handlingStrategy":"validation","validationCode":"func validEndpoint(cfg map[string]any, key string) error {\n    o, ok := cfg[key].(map[string]any)\n    if !ok { return fmt.Errorf(\"%s override missing\", key) }\n    host, _ := o[\"host\"].(string)\n    port, ok := o[\"port\"].(int)\n    if strings.TrimSpace(host) == \"\" || !ok || port < 1 || port > 65535 {\n        return fmt.Errorf(\"%s must include host and integer port 1-65535\", key)\n    }\n    return nil\n}","typeGuard":"func isValidEndpoint(o map[string]any) bool {\n    h, ok := o[\"host\"].(string)\n    if !ok || strings.TrimSpace(h) == \"\" { return false }\n    p, ok := o[\"port\"].(int)\n    return ok && p >= 1 && p <= 65535\n}","tryCatchPattern":"addr, err := endpointOverride(config, \"management\")\nif err != nil {\n    return fmt.Errorf(\"config error in %q: %w\", \"management\", err)\n}","preventionTips":["Validate the whole config file with a schema at load time","Always express ports as integers in YAML/JSON (quote nothing)","Keep host/port key names consistent across all override sections"],"tags":["config","validation","endpoint"],"backgroundTag":"invalid-endpoint-config","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}