{"record":{"id":"ee63cb7cb693a80d","repo":"vitessio/vitess","slug":"unreachable","errorCode":null,"errorMessage":"unreachable","messagePattern":"unreachable","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/mysql/collations/colldata/unicode.go","lineNumber":263,"sourceCode":"\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tsrc = src[width:]\n\t\t\tdst = append(dst, byte((r>>16)&0xFF), byte((r>>8)&0xFF), byte(r&0xFF))\n\t\t}\n\n\t\tif numCodepoints == PadToMax {\n\t\t\tfor len(dst)+2 < cap(dst) {\n\t\t\t\tdst = append(dst, 0x00, 0x00, 0x20)\n\t\t\t}\n\t\t\tswitch cap(dst) - len(dst) {\n\t\t\tcase 0:\n\t\t\tcase 1:\n\t\t\t\tdst = append(dst, 0x00)\n\t\t\tcase 2:\n\t\t\t\tdst = append(dst, 0x00, 0x00)\n\t\t\tdefault:\n\t\t\t\tpanic(\"unreachable\")\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor numCodepoints > 0 {\n\t\t\tr, width, ok := cs.DecodeRune(src)\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tsrc = src[width:]\n\t\t\tdst = append(dst, byte((r>>16)&0xFF), byte((r>>8)&0xFF), byte(r&0xFF))\n\t\t\tnumCodepoints--\n\t\t}\n\t\tfor numCodepoints > 0 {\n\t\t\tdst = append(dst, 0x00, 0x00, 0x20)\n\t\t\tnumCodepoints--\n\t\t}\n\t}","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/mysql/collations/colldata/unicode.go#L245-L281","documentation":"weightStringUnicode pads each codepoint's weight in the unicode (uci) layout and handles padding widths 0-2; any other width is impossible by construction. Hitting panic(\"unreachable\") means an internal invariant broke — the padding width derived from the collation's weight table exceeded the expected range.","triggerScenarios":"Calling WeightString on a unicode-layout collation whose generated weight data yields a padding case other than 0, 1, or 2 — i.e. corrupted or hand-edited collation tables, or a custom collation built with wrong weight widths.","commonSituations":"Running a custom-built Vitess binary with regenerated collation tables that don't match the generated code; modifying uca/unicode table generation scripts incorrectly.","solutions":["Rebuild from a clean checkout — regenerated collation tables are likely out of sync with the code","If a custom collation was added, fix its weight widths so each codepoint's weight list yields at most 2 padding bytes","Report as a bug with the collation name and input string if stock collations trigger it"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"defer func() {\n\tif r := recover(); r != nil {\n\t\tlog.Warn(\"unicode WeightString invariant failure\", slog.Any(\"panic\", r))\n\t\t// fall back to a safe hash or propagate an error\n\t}\n}()","preventionTips":["Never hand-edit generated collation weight tables","Rebuild from clean checkout if collation data was regenerated","Report stock-collation occurrences as bugs"],"tags":["panic","collations","internal-invariant"],"backgroundTag":"unreachable-invariant-violation","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}