elastic/elasticsearch · error · RuntimeException

Invalid escaped char in [{s}]

Error message

Invalid escaped char in [{s}]

What it means

Error "Invalid escaped char in [{s}]" thrown in elastic/elasticsearch.

Source

Thrown at modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CharGroupTokenizerFactory.java:66

                tokenizeOnChars.add((int) parseEscapedChar(c));
            } else {
                switch (c) {
                    case "letter" -> tokenizeOnLetter = true;
                    case "digit" -> tokenizeOnDigit = true;
                    case "whitespace" -> tokenizeOnSpace = true;
                    case "punctuation" -> tokenizeOnPunctuation = true;
                    case "symbol" -> tokenizeOnSymbol = true;
                    default -> throw new RuntimeException("Invalid escaped char in [" + c + "]");
                }
            }
        }
    }

    private static char parseEscapedChar(final String s) {
        int len = s.length();
        char c = s.charAt(0);
        if (c == '\\') {
            if (1 >= len) throw new RuntimeException("Invalid escaped char in [" + s + "]");
            c = s.charAt(1);
            switch (c) {
                case '\\':
                    return '\\';
                case 'n':
                    return '\n';
                case 't':
                    return '\t';
                case 'r':
                    return '\r';
                case 'b':
                    return '\b';
                case 'f':
                    return '\f';
                case 'u':
                    if (len > 6) {
                        throw new RuntimeException("Invalid escaped char in [" + s + "]");
                    }

View on GitHub (pinned to db6a809a66)

When it happens

Trigger: Thrown at modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/CharGroupTokenizerFactory.java:66 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/f7640aad3d50eb2d. Report an issue: GitHub.