{"record":{"id":"d14fdc2c7d6c2b98","repo":"quarkusio/quarkus","slug":"invalid-parameter-index-index-used-when-obtai","errorCode":null,"errorMessage":"Invalid parameter index '${index}' used when obtaining parameter values","messagePattern":"Invalid parameter index '(.+?)' used when obtaining parameter values","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ComputedParamContextImpl.java","lineNumber":60,"sourceCode":"    @Override\n    public String name() {\n        return name;\n    }\n\n    @Override\n    public List<MethodParameter> methodParameters() {\n        return parameters;\n    }\n\n    public static Object getMethodParameterFromContext(ClientRequestContext context, int index) {\n        Object property = context.getProperty(INVOKED_METHOD_PARAMETERS_PROP);\n        if (property == null) {\n            throw new IllegalStateException(\n                    \"property \" + INVOKED_METHOD_PARAMETERS_PROP + \" should have been part of the client context\");\n        }\n        List<Object> methodParameterValues = (List<Object>) property;\n        if (index > methodParameterValues.size() - 1) {\n            throw new IllegalArgumentException(\"Invalid parameter index '\" + index + \"' used when obtaining parameter values\");\n        }\n        return methodParameterValues.get(index);\n    }\n\n    private static class MethodParameterImpl implements MethodParameter {\n\n        private final Object value;\n\n        private MethodParameterImpl(Object value) {\n            this.value = value;\n        }\n\n        @Override\n        public Object value() {\n            return value;\n        }\n    }\n}","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-reactive/rest-client/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/ComputedParamContextImpl.java#L42-L78","documentation":"This error is thrown by ComputedParamContextImpl.getMethodParameterFromContext when resolving a @PathParam/@QueryParam-style template expression that references a method parameter by index, but the index is out of range of the actual client method parameters. It means the rest client generated a parameter reference that does not exist in the invoked method signature. The library throws it to fail fast instead of returning null for a missing parameter value.","triggerScenarios":"Calling a REST client interface method whose @BeanParam or template expression (e.g. {0} or a computed parameter) references parameter index N while the method has fewer than N+1 parameters; typically caused by mismatched generated code or hand-written custom param providers using wrong indices.","commonSituations":"After refactoring a client interface method signature (removing/adding parameters) without updating annotation/computed-parameter indices; misconfigured ClientRequestFilter or custom ParamConverter provider supplying INVOKED_METHOD_PARAMETERS_PROP incorrectly.","solutions":["Fix the template/computed parameter index in the client method annotations to match the actual parameter positions","Restore the removed/renamed method parameter that the index refers to","Rebuild the project so generated rest-client code is regenerated in sync with the interface"],"exampleFix":"// before\n@Path(\"/{id}/items/{0}\")\nResponse get(@PathParam(\"id\") String id);\n// after\n@Path(\"/{id}/items/{item}\")\nResponse get(@PathParam(\"id\") String id, @PathParam(\"item\") String item);","handlingStrategy":"validation","validationCode":"int idx = 0; // index you intend to use\njava.util.List<?> params = getInvokedMethodParameters(ctx); // or count method params\nif (idx < 0 || idx >= params.size()) {\n    throw new IllegalStateException(\"Parameter index \" + idx + \" out of range (\" + params.size() + \" params)\");\n}","typeGuard":"boolean isValidParamIndex(int index, int paramCount) {\n    return index >= 0 && index < paramCount;\n}","tryCatchPattern":"try {\n    Object v = ctx.getMethodParameter(index);\n} catch (IllegalArgumentException e) {\n    log.warn(\"Bad template parameter index: {}\", e.getMessage());\n    v = null; // or fall back to a default value\n}","preventionTips":["Prefer named path/query parameters over positional indices","Rebuild after every change to a client interface method signature","Keep custom param-supplying filters/providers in sync with method parameter counts"],"tags":["rest-client","parameter-binding","illegal-argument"],"backgroundTag":"invalid-parameter-index","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"}