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
- Fix the @Path on the method (and class): close every {param} and make any :regex a valid Java regex.
- Test the regex portion with Pattern.compile in isolation to locate the syntax error.
- 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
- Keep custom regex constraints in path variables simple and unit-tested.
- Use IDE JAX-RS path validation where available.
- Run a startup smoke test in CI.
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
- Class %s has no fields. Parameters containers are only suppo
- No annotations found on fields at '%s'. Annotations like `@Q
- Body parameters (or non-annotated fields) are not allowed fo
- Could not create converter for ${elementType} for ${builder.
- 'java.time.Instant' types must not be annotated with '@DateF
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/9cdd65a468832516.
Report an issue: GitHub.