{"record":{"id":"5094f9cd85c7a7ef","repo":"vitessio/vitess","slug":"row-v-is-missing-from-result","errorCode":null,"errorMessage":"row %v is missing from result","messagePattern":"row (.+?) is missing from result","errorType":"error_code","errorClass":"RowMismatchError","httpStatus":null,"severity":"error","filePath":"go/sqltypes/parse_rows.go","lineNumber":161,"sourceCode":"\t\t}\n\t}\n\n\tmatched := make([]bool, len(want))\n\tfor _, aa := range want {\n\t\tvar ok bool\n\t\tfor i, bb := range got {\n\t\t\tif matched[i] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif RowEqual(aa, bb) {\n\t\t\t\tmatched[i] = true\n\t\t\t\tok = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !ok {\n\t\t\treturn &RowMismatchError{\n\t\t\t\terr:  fmt.Errorf(\"row %v is missing from result\", aa),\n\t\t\t\twant: want,\n\t\t\t\tgot:  got,\n\t\t\t}\n\t\t}\n\t}\n\tfor _, m := range matched {\n\t\tif !m {\n\t\t\treturn errors.New(\"not all elements matched\")\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc RowsEqualsStr(wantStr string, got []Row) error {\n\twant, err := ParseRows(wantStr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"malformed row assertion: %w\", err)\n\t}","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/sqltypes/parse_rows.go#L143-L179","documentation":"After the length check passes, RowsEquals greedily matches each expected row against unconsumed actual rows using Row equality. If an expected row has no unmatched counterpart in got, it returns a RowMismatchError with 'row %v is missing from result'.","triggerScenarios":"Calling RowsEquals / RowsEqualsStr / AssertMatchesNoOrder where row counts match but at least one expected row's values differ from every actual row (e.g. a column value differs, or type/bytes differ).","commonSituations":"Column value produced differently than expected (formatting, NULL vs empty string, numeric type mismatch), unordered results where a duplicate row replaced another, or fixture data drift.","solutions":["Print/inspect the missing row (aa) against got rows to find the value difference","Check for type/encoding differences in bytes (MakeTrusted keeps raw bytes; '\\x00' vs '' etc.)","Fix the query or expected string so the row contents match"],"exampleFix":"// before\nwant := \"(1, 'a'), (2, 'b')\" // got (2, 'B')\n// after\nwant := \"(1, 'a'), (2, 'B')\"","handlingStrategy":"type-guard","validationCode":"// pre-check a canary row exists\nfound := false\nfor _, g := range got { if sqltypes.RowsEqual(g, want[0]) { found = true } }\nif !found { return fmt.Errorf(\"canary row missing\") }","typeGuard":"func containsRow(hay []sqltypes.Row, needle sqltypes.Row) bool {\n  for _, h := range hay { if sqltypes.RowsEqual(h, needle) { return true } }\n  return false\n}","tryCatchPattern":"err := sqltypes.RowsEquals(want, got)\nvar rm *sqltypes.RowMismatchError\nif errors.As(err, &rm) { t.Fatalf(\"missing row: %v\", err) }","preventionTips":["Diff actual vs expected sets when the test fails","Watch for NULL vs empty-string and byte-level type differences","Regenerate expected strings after intentional query changes"],"tags":["testing","assertion","row-mismatch"],"backgroundTag":"row-content-mismatch","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}