jdx/mise · error

expected closing parenthesis

Error message

expected closing parenthesis

What it means

Parser for aqua template expressions consumed an opening parenthesis and parsed the inner pipe expression, but the next token was not a closing ')' — the input is unbalanced (typo, stray token, or truncated template) so parse_primary rejects it.

Solutions

  1. Balance the parentheses in the template expression
  2. Check for a missing ')' after a nested function call
  3. Simplify the expression and rebuild it piece by piece to find the typo
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/aqua-registry/src/template.rs:244 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/f6208f74bbb2a7c5. Report an issue: GitHub.

Appendix: source

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

    Ok(left)
}

/// Parse primary expressions
fn parse_primary(tokens: &mut std::iter::Peekable<std::slice::Iter<Token>>) -> Result<Expr> {
    skip_whitespace(tokens);

    let token = tokens.next().wrap_err("unexpected end of expression")?;

    let expr = match token {
        Token::Key(k) => Expr::Var(k.to_string()),
        Token::String(s) => Expr::Literal(s.to_string()),
        Token::LParen => {
            // Parenthesized expression: (func arg)
            skip_whitespace(tokens);
            let inner = parse_pipe(tokens)?;
            skip_whitespace(tokens);
            if !matches!(tokens.next(), Some(Token::RParen)) {
                bail!("expected closing parenthesis");
            }
            inner
        }
        Token::Func(f) => {
            // Function call: func arg1 arg2
            let func_name = f.to_string();
            let mut args = Vec::new();

            // Collect arguments until we hit pipe, rparen, or end
            loop {
                skip_whitespace(tokens);

                match tokens.peek() {
                    None | Some(Token::Pipe) | Some(Token::RParen) => break,
                    Some(Token::Dot) | Some(Token::Ident(_)) => break, // Stop before property access
                    _ => {
                        args.push(parse_arg(tokens)?);
                    }

View on GitHub (pinned to 533346cc37)