quarkusio/quarkus · error · IllegalArgumentException

Path '${method.getPath()}' of method '${currentClassInfo.nam

Error message

Path '${method.getPath()}' of method '${currentClassInfo.name()}#${info.name()}' is not a valid expression

What it means

During deployment, validateMethodPath compiles the resolved method path (class @Path + method @Path) into a URITemplate. If the resulting template has invalid syntax — malformed {param} expressions, unbalanced braces, or an invalid regex pattern in a variable — the PatternSyntaxException is wrapped in this IllegalArgumentException and the deployment fails.

Source

Thrown at independent-projects/resteasy-reactive/server/processor/src/main/java/org/jboss/resteasy/reactive/server/processor/ServerEndpointIndexer.java:362

            invokerSupplier = endpointInvokerFactory.create(method, currentClassInfo, info);
        }
        method.setInvoker(invokerSupplier);
        Set<String> methodAnnotationNames = new HashSet<>();
        Collection<AnnotationInstance> instances = annotationStore.getAnnotations(info);
        for (AnnotationInstance instance : instances) {
            methodAnnotationNames.add(instance.name().toString());
        }
        method.setMethodAnnotationNames(methodAnnotationNames);

        // validate the path
        validateMethodPath(method, currentClassInfo, info);
    }

    private void validateMethodPath(ServerResourceMethod method, ClassInfo currentClassInfo, MethodInfo info) {
        try {
            new URITemplate(method.getPath(), false);
        } catch (PatternSyntaxException e) {
            throw new IllegalArgumentException("Path '" + method.getPath() + "' of method '" + currentClassInfo.name() + "#"
                    + info.name() + "' is not a valid expression", e);
        }
    }

    @Override
    protected InjectableBean scanInjectableBean(ClassInfo currentClassInfo, ClassInfo actualEndpointInfo,
            Map<String, String> existingConverters, AdditionalReaders additionalReaders,
            Map<String, InjectableBean> injectableBeans, boolean hasRuntimeConverters) {

        // do not scan a bean twice
        String currentTypeName = currentClassInfo.name().toString();
        InjectableBean currentInjectableBean = injectableBeans.get(currentTypeName);
        if (currentInjectableBean != null) {
            return currentInjectableBean;
        }
        currentInjectableBean = new BeanParamInfo();
        injectableBeans.put(currentTypeName, currentInjectableBean);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Fix the @Path on the method (and class): close every {param} and make any :regex a valid Java regex.
  2. Test the regex portion with Pattern.compile in isolation to locate the syntax error.
  3. Replace non-JAX-RS placeholder styles with {param} syntax.

Example fix

// before
@Path("/users/{id")
public User get(@PathParam("id") long id) { ... }

// after
@Path("/users/{id}")
public User get(@PathParam("id") long id) { ... }
Defensive patterns

Strategy: validation

Validate before calling

try {
    new io.quarkus.resteasy.reactive.common.core.URITemplate(path, false);
} catch (java.util.regex.PatternSyntaxException e) {
    throw new IllegalStateException("Invalid @Path: " + path, e);
}

Try / catch

try {
    startApplication();
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("is not a valid expression")) {
        log.error("Fix the @Path template mentioned in the message");
    } else { throw e; }
}

Prevention

When it happens

Trigger: @Path("/items/{id") (unclosed brace), @Path("/items/{id:[a-z") (invalid regex inside the variable), or class+method path concatenation yielding invalid syntax.

Common situations: Typos in path templates; hand-written custom regex constraints in variables; placeholder syntax copied from other frameworks (e.g. :id or <id>).

Related errors


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