{"record":{"id":"31760112d40e2905","repo":"quarkusio/quarkus","slug":"unable-to-extract-the-path-parameter-name-method","errorCode":null,"errorMessage":"Unable to extract the path parameter name - method parameter names not recorded for %s: compile the class with -parameters","messagePattern":"Unable to extract the path parameter name - method parameter names not recorded for (.+?): compile the class with -parameters","errorType":"exception","errorClass":"WebSocketException","httpStatus":null,"severity":"error","filePath":"extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/PathParamCallbackArgument.java","lineNumber":64,"sourceCode":"        String paramName = getParamName(context);\n        return context.bytecode().invokeVirtual(\n                MethodDesc.of(WebSocketConnectionBase.class, \"pathParam\", String.class, String.class),\n                context.getConnection(), Const.of(paramName));\n    }\n\n    private String getParamName(ParameterContext context) {\n        AnnotationInstance pathParamAnnotation = Annotations.find(context.parameterAnnotations(), WebSocketDotNames.PATH_PARAM);\n        if (pathParamAnnotation != null) {\n            String name;\n            AnnotationValue nameVal = pathParamAnnotation.value();\n            if (nameVal != null) {\n                name = nameVal.asString();\n            } else {\n                // Try to use the element name\n                name = context.parameter().name();\n            }\n            if (name == null) {\n                throw new WebSocketException(String.format(\n                        \"Unable to extract the path parameter name - method parameter names not recorded for %s: compile the class with -parameters\",\n                        context.parameter().method().declaringClass().name()));\n            }\n            return name;\n        }\n        return null;\n    }\n\n    static List<String> getPathParamNames(String path) {\n        List<String> names = new ArrayList<>();\n        Matcher m = WebSocketProcessor.TRANSLATED_PATH_PARAM_PATTERN.matcher(path);\n        while (m.find()) {\n            names.add(m.group().substring(1));\n        }\n        return names;\n    }\n\n}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/websockets-next/deployment/src/main/java/io/quarkus/websockets/next/deployment/PathParamCallbackArgument.java#L46-L82","documentation":"Quarkus websockets-next needs a @PathParam parameter's name, but neither an explicit value was given on the annotation nor could the name be inferred because the class was compiled without the -parameters flag. The build fails so the path parameter is never silently left unbound.","triggerScenarios":"Using bare @PathParam without a value on a callback method parameter in a class compiled without -parameters (e.g. default javac/maven config lacking <compilerArgs>-parameters</compilerArgs>, or an unannotated third-party endpoint class added to the archive).","commonSituations":"New Maven/Gradle projects missing the -parameters compiler argument (common when overriding maven-compiler-plugin config); IDE-compiled classes lacking parameter name info; libraries shipping precompiled websocket endpoints.","solutions":["Add the -parameters flag to the compiler configuration (maven-compiler-plugin <parameters>true</parameters> or Gradle compileJava { options.compilerArgs << '-parameters' })","Or specify the name explicitly: @PathParam(\"roomId\") instead of bare @PathParam","Recompile the endpoint class after fixing compiler settings"],"exampleFix":"// before\n<artifactId>maven-compiler-plugin</artifactId> <!-- no -parameters -->\n// after\n<plugin>\n  <artifactId>maven-compiler-plugin</artifactId>\n  <configuration><parameters>true</parameters></configuration>\n</plugin>","handlingStrategy":"validation","validationCode":"// build.gradle.kts — ensure parameter names are recorded\ntasks.compileJava { options.compilerArgs.add(\"-parameters\") }\n// or Maven: <parameters>true</parameters> in maven-compiler-plugin","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always enable -parameters in every module that declares websocket endpoints","Prefer explicit @PathParam(\"name\") values to be compiler-flag independent","Add a CI check that builds without skipping compiler config overrides"],"tags":["websocket","build-time","compiler-flags","path-parameter"],"backgroundTag":"missing-parameters-compiler-flag","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"}