XTLS/Xray-core · error

invalid sudoku ascii mode: %s

Error message

invalid sudoku ascii mode: %s

What it means

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.

Source

Thrown at transport/internet/finalmask/sudoku/table.go:174

		pMin = 100
	}
	if pMax > 100 {
		pMax = 100
	}
	if pMax < pMin {
		pMax = pMin
	}
	return pMin, pMax
}

func normalizeASCII(mode string) (string, error) {
	switch strings.ToLower(strings.TrimSpace(mode)) {
	case "", "entropy", "prefer_entropy":
		return "prefer_entropy", nil
	case "ascii", "prefer_ascii":
		return "prefer_ascii", nil
	default:
		return "", fmt.Errorf("invalid sudoku ascii mode: %s", mode)
	}
}

func normalizeCustomTable(pattern string) (string, error) {
	cleaned := strings.ToLower(strings.TrimSpace(pattern))
	cleaned = strings.ReplaceAll(cleaned, " ", "")
	if len(cleaned) != 8 {
		return "", fmt.Errorf("customTable must be 8 chars, got %d", len(cleaned))
	}

	var xCount, pCount, vCount int
	for _, ch := range cleaned {
		switch ch {
		case 'x':
			xCount++
		case 'p':
			pCount++
		case 'v':

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. Set ascii to "prefer_entropy" or remove the field entirely (empty string defaults to prefer_entropy).
  2. If you want ASCII-friendly bytes, set ascii: "prefer_ascii".
  3. Verify there are no stray quotes/whitespace issues; the value is trimmed and lowercased, so only the spelling itself matters.

Example fix

// before
"ascii": "true"
// after
"ascii": "prefer_ascii"
Defensive patterns

Strategy: validation

Validate before calling

func validAsciiMode(s string) bool {
	switch strings.ToLower(strings.TrimSpace(s)) {
	case "", "entropy", "prefer_entropy", "ascii", "prefer_ascii":
		return true
	}
	return false
}

if !validAsciiMode(cfg.Ascii) {
	return fmt.Errorf("reject config: bad ascii mode %q", cfg.Ascii)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/d751ea8039be3d82. Report an issue: GitHub.