quarkusio/quarkus · error · IllegalArgumentException

Expresion command must be an ASCII char: " + command

Error message

Expresion command must be an ASCII char: " + command

What it means

Thrown by the ParserConfig compact constructor when the configured expression command character is not an ASCII character (code point 0-127). Qute allows changing the default '{' expression delimiter only to a single ASCII char.

Source

Thrown at independent-projects/qute/core/src/main/java/io/quarkus/qute/ParserConfig.java:24

 * The set of possible expression commands is limited.
 * Only ASCII characters are allowed.
 * Some characters are reserved: {@code #}, {@code /}, {@code @}, {@code _}, {@code |}, {@code !}.
 * Digit/alphabetic chars are also disallowed.
 *
 * @param expressionCommand the command characted used to identify an output expression
 */
public record ParserConfig(Character expressionCommand) {

    /**
     * By default, no special expression command is used.
     */
    public static final ParserConfig DEFAULT = new ParserConfig(null);

    public ParserConfig {
        if (expressionCommand != null) {
            char command = expressionCommand.charValue();
            if (command < 0 || command > 127) {
                throw new IllegalArgumentException("Expresion command must be an ASCII char: " + command);
            }
            if (Parser.Tag.isCommand(command, null)
                    || command == Parser.COMMENT_DELIMITER
                    || command == Parser.CDATA_START_DELIMITER
                    || command == Parser.UNDERSCORE) {
                throw new IllegalArgumentException("Expresion command is reserved: " + command);
            }
            if (Character.isDigit(command)
                    || Character.isAlphabetic(command)) {
                throw new IllegalArgumentException("Expresion command must not be a digit/alphabetic: " + command);
            }
        }
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Choose a plain ASCII character as the expression command, e.g. '$' or '#'.
  2. Validate the character before constructing ParserConfig: check c >= 0 && c <= 127.
  3. If the desired symbol is non-ASCII, transliterate it to an ASCII equivalent.

Example fix

// before
ParserConfig config = new ParserConfig('{'); // fullwidth char, non-ASCII

// after
ParserConfig config = new ParserConfig('$'); // ASCII char
Defensive patterns

Strategy: validation

Validate before calling

char c = expressionCommand.charAt(0);
if (c < 0 || c > 127) {
    throw new IllegalArgumentException("expression command must be ASCII, got: " + (int) c);
}

Type guard

static boolean isAsciiChar(String s) {
    return s != null && s.length() == 1 && s.charAt(0) <= 127;
}

Try / catch

try {
    ParserConfig config = new ParserConfig(expressionCommand);
} catch (IllegalArgumentException e) {
    // fall back to default config (null = '{') and log a warning
    ParserConfig config = ParserConfig.DEFAULT;
}

Prevention

When it happens

Trigger: Calling EngineBuilder.parser(new ParserConfig(expressionCommand)) (or ParserConfig constructor) with a String whose char value is outside 0-127, e.g. '{ƒ' or any non-Latin character.

Common situations: Users picking a delimiter from a non-ASCII keyboard layout or copying a lookalike character (fullwidth '{', curly quotes) into configuration; building the config from user input without validation.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/03a9271aa077f1ce. Report an issue: GitHub.