{"record":{"id":"d0d821f22f4ca14a","repo":"quarkusio/quarkus","slug":"parameter-names-don-t-match-variable-names-on-ty","errorCode":null,"errorMessage":"Parameter names don't match variable names on ${typeDef}::${method}","messagePattern":"Parameter names don't match variable names on (.+?)::(.+?)","errorType":"validation","errorClass":"RestClientDefinitionException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/QuarkusRestClientBuilder.java","lineNumber":644,"sourceCode":"                    org.jboss.resteasy.annotations.jaxrs.PathParam rePathParam = p\n                            .getAnnotation(org.jboss.resteasy.annotations.jaxrs.PathParam.class);\n                    String name = rePathParam.value() == null || rePathParam.value()\n                            .length() == 0 ? p.getName() : rePathParam.value();\n                    paramMap.put(name, \"foobar\");\n                } else if (p.isAnnotationPresent(BeanParam.class)) {\n                    verifyBeanPathParam(p.getType(), paramMap);\n                }\n            }\n\n            if (allVariables.size() != paramMap.size()) {\n                throw new RestClientDefinitionException(\n                        \"Parameters and variables don't match on \" + typeDef + \"::\" + method.getName());\n            }\n\n            try {\n                template.resolveTemplates(paramMap, false).build();\n            } catch (IllegalArgumentException ex) {\n                throw new RestClientDefinitionException(\n                        \"Parameter names don't match variable names on \" + typeDef + \"::\" + method.getName(), ex);\n            }\n\n        }\n    }\n\n    @Override\n    public Configuration getConfiguration() {\n        return getConfigurationWrapper();\n    }\n\n    @Override\n    public RestClientBuilder property(String name, Object value) {\n        if (name.startsWith(RESTEASY_PROPERTY_PREFIX)) {\n            // Makes it possible to configure some of the ResteasyClientBuilder delegate properties\n            String builderMethodName = name.substring(RESTEASY_PROPERTY_PREFIX.length());\n            Method builderMethod = Arrays.stream(ResteasyClientBuilder.class.getMethods())\n                    .filter(m -> builderMethodName.equals(m.getName()) && m.getParameterCount() >= 1)","sourceCodeStart":626,"sourceCodeEnd":662,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-classic/resteasy-client/runtime/src/main/java/io/quarkus/restclient/runtime/QuarkusRestClientBuilder.java#L626-L662","documentation":"Thrown by verifyInterface during build as a RestClientDefinitionException when template.resolveTemplates fails with IllegalArgumentException — i.e. the @Path template references variables that no parameter binds, or a parameter binds a variable that doesn't exist. It is the resolution-stage companion to the parameter/variable count check.","triggerScenarios":"@Path uses {filter} but the method parameter is @PathParam(\"filterBy\") — names differ; a variable appears only in a class-level @Path that the method params don't supply; duplicate variable names with conflicting bindings.","commonSituations":"Renaming either the template variable or the annotation value but not both; forgetting a class-level {tenant} variable has no bound parameter (class-level vars need @PathParam on the method too in MP REST client); typos in variable names.","solutions":["Align @PathParam(\"...\") values exactly with the {variable} names in @Path","Provide bindings for variables declared on the class-level @Path as well","Run a local request/test early — this fails at client build time, so a smoke test catches it immediately"],"exampleFix":"// before\n@Path(\"/orgs/{orgId}\")\n@GET\nItem get(@PathParam(\"org\") String orgId); // name mismatch\n// after\n@Path(\"/orgs/{orgId}\")\n@GET\nItem get(@PathParam(\"orgId\") String orgId);","handlingStrategy":"validation","validationCode":"// Resolve check: every {var} in @Path (class + method) must be bound by some @PathParam\nSet<String> bound = new HashSet<>();\nfor (java.lang.reflect.Parameter par : method.getParameters()) {\n    PathParam pp = par.getAnnotation(PathParam.class);\n    if (pp != null) bound.add(pp.value());\n}\nPattern pat = Pattern.compile(\"\\\\{([^}]+)\\\\}\");\nfor (String tpl : new String[]{classLevelPath, methodLevelPath}) {\n    if (tpl == null) continue;\n    Matcher m2 = pat.matcher(tpl);\n    while (m2.find()) if (!bound.contains(m2.group(1)))\n        throw new IllegalStateException(\"Unbound path variable: \" + m2.group(1));\n}","typeGuard":null,"tryCatchPattern":"try {\n    client = builder.build(MyClient.class);\n} catch (RestClientDefinitionException e) {\n    if (e.getMessage().contains(\"Parameter names don't match variable names\")) {\n        log.error(\"Template variable name mismatch: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Use identical names for @PathParam values and {template} variables","Remember class-level @Path variables also need matching @PathParam method parameters","Use IDE inspections or an arch-unit test to validate client interfaces","Build the client in a smoke test so RestClientDefinitionException surfaces in CI"],"tags":["rest-client","interface-validation","path-param","template","rest-client-definition-exception"],"backgroundTag":"path-template-mismatch","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}