jdx/mise · error

unexpected character

Error message

unexpected character: {}

What it means

Lexer for the aqua-registry template expression language encountered a character that starts no known token (not a digit, dot, quote, identifier char, or parenthesis). The offending character is included in the message; lexing stops because the rest of the expression cannot be tokenized.

Solutions

  1. Remove or quote the unexpected character in the template string
  2. Compare against aqua's supported template syntax (identifiers, dotted properties, quoted strings, function calls)
  3. Add the missing character class to the lexer if the aqua grammar allows it
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/aqua-registry/src/template.rs:182 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/7ef6c03e01ec76cd. Report an issue: GitHub.

Appendix: source

Thrown at crates/aqua-registry/src/template.rs:182

                tokens.push(Token::Dot);
                code = &code[1..];
            }
        } else {
            // Check if it's an identifier (alphanumeric starting with letter)
            let end = code
                .chars()
                .enumerate()
                .find(|(_, c)| !c.is_alphanumeric() && *c != '_' && *c != '-')
                .map(|(i, _)| i)
                .unwrap_or(code.len());

            if end > 0 {
                let token_str = &code[..end];
                // Determine if this is a function or identifier based on context
                tokens.push(Token::Func(token_str));
                code = &code[end..];
            } else {
                bail!("unexpected character: {}", code.chars().next().unwrap());
            }
        }
    }
    Ok(tokens)
}

fn dotted_identifier_end(code: &str) -> Option<usize> {
    let rest = code.strip_prefix('.')?;
    let first = rest.chars().next()?;
    if !first.is_alphabetic() {
        return None;
    }
    Some(1 + identifier_len(rest))
}

fn identifier_len(code: &str) -> usize {
    code.char_indices()
        .find(|(_, c)| !c.is_alphanumeric() && *c != '_')

View on GitHub (pinned to 533346cc37)