{"record":{"id":"34d68d2aaa989346","repo":"XTLS/Xray-core","slug":"not-enough-sudoku-grids-d","errorCode":null,"errorMessage":"not enough sudoku grids: %d","messagePattern":"not enough sudoku grids: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"transport/internet/finalmask/sudoku/table.go","lineNumber":385,"sourceCode":"\n\treturn &byteLayout{\n\t\thintMask:    xMask,\n\t\thintValue:   xMask,\n\t\tpadMarker:   padding[0],\n\t\tpaddingPool: padding,\n\t\tencodeHint:  encodeGroup,\n\t\tencodeGroup: encodeGroup,\n\t\tdecodeGroup: decodeGroup,\n\t}, nil\n}\n\nfunc buildTable(password string, layout *byteLayout) (*table, error) {\n\tpatterns, err := getBasePatterns()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(patterns) < 256 {\n\t\treturn nil, fmt.Errorf(\"not enough sudoku grids: %d\", len(patterns))\n\t}\n\n\torder := make([]int, len(patterns))\n\tfor i := range order {\n\t\torder[i] = i\n\t}\n\n\thash := sha256.Sum256([]byte(password))\n\tseed := int64(binary.BigEndian.Uint64(hash[:8]))\n\trng := rand.New(rand.NewSource(seed))\n\trng.Shuffle(len(order), func(i, j int) {\n\t\torder[i], order[j] = order[j], order[i]\n\t})\n\n\tt := &table{\n\t\tdecode: make(map[uint32]byte, 1<<16),\n\t\tlayout: layout,\n\t}","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/transport/internet/finalmask/sudoku/table.go#L367-L403","documentation":"Thrown by buildTable when getBasePatterns returns fewer than 256 sudoku grid pattern sets. The encoding maps every byte value 0-255 to a distinct grid, so fewer than 256 grids makes the scheme impossible. This is an internal invariant of the sudoku generator, not a user config error.","triggerScenarios":"getBasePatterns failing to enumerate enough valid grids, e.g. after a change to grid generation or clue-set filtering. Also possible if grid enumeration is truncated by memory limits in constrained environments.","commonSituations":"Running a modified or older build where the grid generator differs from the layout code; extremely memory-constrained containers where grid generation silently yields partial results; essentially never seen on a stock build.","solutions":["Update to a consistent version of the finalmask transport (generator and table code must match).","Check available memory in the running container/host; grid generation is memory-heavy.","If reproducible on a stock build, report it upstream with the exact version."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := newTable(cfg); err != nil {\n\tif strings.Contains(err.Error(), \"not enough sudoku grids\") {\n\t\tlog.Fatal(\"transport build invariant broken; update to a consistent release\")\n\t}\n\treturn err\n}","preventionTips":["Pin a released version of the transport so generator and table code stay in sync.","Treat this error as a build/version defect, not a config problem."],"tags":["finalmask","sudoku","internal-invariant","startup"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}