{"record":{"id":"f7ec52dd93c1b799","repo":"XTLS/Xray-core","slug":"customtable-has-invalid-char-q","errorCode":null,"errorMessage":"customTable has invalid char %q","messagePattern":"customTable has invalid char %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"transport/internet/finalmask/sudoku/table.go","lineNumber":195,"sourceCode":"\nfunc normalizeCustomTable(pattern string) (string, error) {\n\tcleaned := strings.ToLower(strings.TrimSpace(pattern))\n\tcleaned = strings.ReplaceAll(cleaned, \" \", \"\")\n\tif len(cleaned) != 8 {\n\t\treturn \"\", fmt.Errorf(\"customTable must be 8 chars, got %d\", len(cleaned))\n\t}\n\n\tvar xCount, pCount, vCount int\n\tfor _, ch := range cleaned {\n\t\tswitch ch {\n\t\tcase 'x':\n\t\t\txCount++\n\t\tcase 'p':\n\t\t\tpCount++\n\t\tcase 'v':\n\t\t\tvCount++\n\t\tdefault:\n\t\t\treturn \"\", fmt.Errorf(\"customTable has invalid char %q\", ch)\n\t\t}\n\t}\n\tif xCount != 2 || pCount != 2 || vCount != 4 {\n\t\treturn \"\", fmt.Errorf(\"customTable must contain exactly 2 x, 2 p and 4 v\")\n\t}\n\treturn cleaned, nil\n}\n\nfunc resolveLayout(mode, customTable string) (*byteLayout, error) {\n\tif mode == \"prefer_ascii\" {\n\t\treturn asciiLayout(), nil\n\t}\n\n\tif customTable != \"\" {\n\t\treturn customLayout(customTable)\n\t}\n\treturn entropyLayout(), nil\n}","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/transport/internet/finalmask/sudoku/table.go#L177-L213","documentation":"Thrown by normalizeCustomTable when the 8-character pattern contains a character other than x, p, or v. Each slot in the custom byte layout must be one of these three classes (x = fixed mask bits, p = position bits, v = value bits), so any other rune is invalid.","triggerScenarios":"A customTable containing letters outside {x,p,v} such as \"xxbpvvvv\" or digits like \"12ppvvvv\"; separators that are not plain spaces (e.g. hyphens or commas in \"xx-pp-vvvv\") are NOT stripped and will hit this error.","commonSituations":"Using hyphens or underscores as visual separators in the pattern; OCR/copy-paste introducing a wrong character; typing 'b' or 'o' instead of 'p'.","solutions":["Rewrite the pattern using only the letters x, p, and v.","Replace any separator characters with plain spaces or remove them entirely (only spaces are stripped).","Double-check against the 2/2/4 composition rule (2 x, 2 p, 4 v) once the characters are fixed."],"exampleFix":"// before\n\"customTable\": \"xx-pp-vvvv\"\n// after\n\"customTable\": \"xxppvvvv\"","handlingStrategy":"validation","validationCode":"for _, ch := range strings.ReplaceAll(strings.ToLower(strings.TrimSpace(cfg.CustomTable)), \" \", \"\") {\n\tif ch != 'x' && ch != 'p' && ch != 'v' {\n\t\treturn fmt.Errorf(\"customTable has invalid char %q\", ch)\n\t}\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only spaces are stripped; never use hyphens or commas as separators.","Restrict the config field to the alphabet x/p/v at the schema level."],"tags":["config","validation","finalmask","sudoku"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}