{"record":{"id":"aa40b8b0f8241d66","repo":"vitessio/vitess","slug":"findreplicas-malformed-addr-v","errorCode":null,"errorMessage":"FindReplicas: malformed addr %v","messagePattern":"FindReplicas: malformed addr (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/replication.go","lineNumber":1159,"sourceCode":"\tqr, err := mysqld.FetchSuperQuery(ctx, \"SHOW PROCESSLIST\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\taddrs := make([]string, 0, 32)\n\tfor _, row := range qr.Rows {\n\t\t// Check for prefix, since it could be \"Binlog Dump GTID\".\n\t\tif strings.HasPrefix(row[colCommand].ToString(), binlogDumpCommand) {\n\t\t\thost := row[colClientAddr].ToString()\n\t\t\tif host == \"localhost\" {\n\t\t\t\t// If we have a local binlog streamer, it will\n\t\t\t\t// show up as being connected\n\t\t\t\t// from 'localhost' through the local\n\t\t\t\t// socket. Ignore it.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thost, _, err = netutil.SplitHostPort(host)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"FindReplicas: malformed addr %v\", err)\n\t\t\t}\n\t\t\tvar ips []string\n\t\t\tips, err = net.LookupHost(host)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"FindReplicas: LookupHost failed %v\", err)\n\t\t\t}\n\t\t\taddrs = append(addrs, ips...)\n\t\t}\n\t}\n\n\treturn addrs, nil\n}\n\n// GetGTIDMode gets the GTID mode for the server\nfunc (mysqld *Mysqld) GetGTIDMode(ctx context.Context) (string, error) {\n\tconn, err := getPoolReconnect(ctx, mysqld.dbaPool)\n\tif err != nil {\n\t\treturn \"\", err","sourceCodeStart":1141,"sourceCodeEnd":1177,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/replication.go#L1141-L1177","documentation":"FindReplicas parses the replica host addresses reported by `SHOW SLAVE STATUS`/processlist. Each address is passed to netutil.SplitHostPort, and if the address cannot be split into host and port, this error is thrown, aborting the whole lookup.","triggerScenarios":"Calling FindReplicas (directly or via GetReplicas) when a replica reports an addr that is not a valid host:port pair — e.g. empty or malformed host in SHOW REPLICAS / SHOW SLAVE STATUS output.","commonSituations":"Replica connected over a unix socket or reporting 'localhost' variants that escape the earlier localhost filter; unusual replication setups or network configurations where the reported addr lacks a port.","solutions":["Check the replication topology output (`SHOW REPLICAS` / `SHOW SLAVE STATUS`) for malformed or missing addr values","Fix the replica's report_host/report_port configuration so it reports a valid host:port","Ensure replicas connect over TCP with a proper port rather than a local socket","Re-run FindReplicas after correcting the replication configuration"],"exampleFix":"// before: replica reporting via unix socket\n// after: in replica my.cnf\n// report_host = 10.0.0.5\n// report_port = 3306","handlingStrategy":"validation","validationCode":"// validate replica addrs before calling FindReplicas\nfor _, a := range replicaAddrsFromStatus {\n    if _, _, err := netutil.SplitHostPort(a); err != nil {\n        log.Warnf(\"skipping malformed replica addr %q\", a)\n    }\n}","typeGuard":null,"tryCatchPattern":"addrs, err := mysqld.FindReplicas()\nif err != nil && strings.Contains(err.Error(), \"malformed addr\") {\n    log.Warn(\"replica reported malformed addr; check report_host config\", slog.Any(\"error\", err))\n}","preventionTips":["Always set report_host/report_port to valid TCP host:port in replica my.cnf","Avoid unix-socket-only replication setups","Periodically audit SHOW REPLICAS output for malformed addrs"],"tags":["network","mysqlctl","replication"],"backgroundTag":"malformed-host-port","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}