{"record":{"id":"43b96e7ea4279daf","repo":"vitessio/vitess","slug":"unexpected-number-of-rows-received-v","errorCode":null,"errorMessage":"unexpected number of rows received - %v","messagePattern":"unexpected number of rows received - (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/replication.go","lineNumber":1362,"sourceCode":"\t\treturn false, err\n\t}\n\tdefer conn.Recycle()\n\n\t// Execute the query to check if the primary is blocked on semi-sync.\n\tsemiSyncWaitSessionsRead := \"select variable_value from performance_schema.global_status where regexp_like(variable_name, 'Rpl_semi_sync_(source|master)_wait_sessions')\"\n\tres, err := conn.Conn.ExecuteFetch(semiSyncWaitSessionsRead, 1, false)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\t// If we have no rows, then the primary doesn't have semi-sync enabled.\n\t// It then follows, that the primary isn't blocked :)\n\tif len(res.Rows) == 0 {\n\t\treturn false, nil\n\t}\n\n\t// Read the status value and check if it is non-zero.\n\tif len(res.Rows) != 1 || len(res.Rows[0]) != 1 {\n\t\treturn false, fmt.Errorf(\"unexpected number of rows received - %v\", res.Rows)\n\t}\n\tvalue, err := res.Rows[0][0].ToCastInt64()\n\treturn value != 0, err\n}\n","sourceCodeStart":1344,"sourceCodeEnd":1367,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/replication.go#L1344-L1367","documentation":"IsSemiSyncBlocked reads a semi-sync status variable via a super query and expects exactly one row with one column. A result of any other shape yields this error because the blocked status cannot be determined.","triggerScenarios":"Calling mysqld.IsSemiSyncBlocked when the SHOW STATUS query returns more than one row or the single row has multiple columns — usually due to a wildcard pattern matching several variables or an incompatible server/proxy response.","commonSituations":"MariaDB vs MySQL naming differences causing multiple matching status variables; proxied connections that alter SHOW STATUS shape; plugin loaded under names that create multiple rows.","solutions":["Run the underlying SHOW STATUS query manually and confirm it returns exactly one row/column for the semi-sync blocked variable","Ensure only one semi-sync status variable matches the query pattern on this server flavor","Bypass proxies that reshape SHOW STATUS results","Upgrade/downgrade mysqlctl to match the server flavor in use"],"exampleFix":"// before: wildcard pattern matching multiple rows\n// after: query the exact variable name\nquery := \"SHOW STATUS LIKE 'Rpl_semi_sync_master_status'\"","handlingStrategy":"type-guard","validationCode":"res, err := mysqld.FetchSuperQuery(ctx, \"SHOW STATUS LIKE 'Rpl_semi_sync_master_status'\")\nif err == nil && (len(res.Rows) != 1 || len(res.Rows[0]) != 1) {\n    log.Warn(\"unexpected semi-sync status shape\")\n}","typeGuard":"func validSingleValueRow(res *sqltypes.Result) bool {\n    return res != nil && len(res.Rows) == 1 && len(res.Rows[0]) == 1\n}","tryCatchPattern":"blocked, err := mysqld.IsSemiSyncBlocked(ctx)\nif err != nil && strings.Contains(err.Error(), \"unexpected number of rows\") {\n    log.Warn(\"semi-sync status unreadable; assuming not blocked\")\n    blocked = false\n}","preventionTips":["Query exact variable names, not wildcards that match multiple rows","Verify status shape after MySQL flavor changes","Avoid reshaping proxies on admin connections"],"tags":["mysql","semi-sync","mysqlctl"],"backgroundTag":"unexpected-query-result-shape","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}