{"record":{"id":"d751ea8039be3d82","repo":"XTLS/Xray-core","slug":"invalid-sudoku-ascii-mode-s","errorCode":null,"errorMessage":"invalid sudoku ascii mode: %s","messagePattern":"invalid sudoku ascii mode: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"transport/internet/finalmask/sudoku/table.go","lineNumber":174,"sourceCode":"\t\tpMin = 100\n\t}\n\tif pMax > 100 {\n\t\tpMax = 100\n\t}\n\tif pMax < pMin {\n\t\tpMax = pMin\n\t}\n\treturn pMin, pMax\n}\n\nfunc normalizeASCII(mode string) (string, error) {\n\tswitch strings.ToLower(strings.TrimSpace(mode)) {\n\tcase \"\", \"entropy\", \"prefer_entropy\":\n\t\treturn \"prefer_entropy\", nil\n\tcase \"ascii\", \"prefer_ascii\":\n\t\treturn \"prefer_ascii\", nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"invalid sudoku ascii mode: %s\", mode)\n\t}\n}\n\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':","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/transport/internet/finalmask/sudoku/table.go#L156-L192","documentation":"Thrown by normalizeASCII in the finalmask sudoku transport when the config's ascii setting is not one of the recognized values. The table builder accepts only \"\", \"entropy\", \"prefer_entropy\", \"ascii\", or \"prefer_ascii\" (compared case-insensitively after trimming whitespace) and maps them to the two layout modes prefer_entropy/prefer_ascii. Any other string fails table construction at startup.","triggerScenarios":"Setting the ascii field in the finalmask transport config to anything other than the five accepted values, e.g. ascii: \"true\", ascii: \"yes\", or a typo like \"prefer-entropy\" (hyphen instead of underscore). newTable() calls normalizeASCII(config.GetAscii()) and returns the error immediately.","commonSituations":"Copying a config from another proxy ecosystem where boolean-looking flags are used; typos or hyphenation differences in YAML/JSON config; upgrading from a version where the field was a bool and not updating the value.","solutions":["Set ascii to \"prefer_entropy\" or remove the field entirely (empty string defaults to prefer_entropy).","If you want ASCII-friendly bytes, set ascii: \"prefer_ascii\".","Verify there are no stray quotes/whitespace issues; the value is trimmed and lowercased, so only the spelling itself matters."],"exampleFix":"// before\n\"ascii\": \"true\"\n// after\n\"ascii\": \"prefer_ascii\"","handlingStrategy":"validation","validationCode":"func validAsciiMode(s string) bool {\n\tswitch strings.ToLower(strings.TrimSpace(s)) {\n\tcase \"\", \"entropy\", \"prefer_entropy\", \"ascii\", \"prefer_ascii\":\n\t\treturn true\n\t}\n\treturn false\n}\n\nif !validAsciiMode(cfg.Ascii) {\n\treturn fmt.Errorf(\"reject config: bad ascii mode %q\", cfg.Ascii)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate the ascii field against the five accepted values in your config loader before starting the transport.","Treat the field as an enum, not a free-form string, in config schemas/templates."],"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"}