{"record":{"id":"8c59513cd950637f","repo":"oracle/graal","slug":"too-many-arguments","errorCode":null,"errorMessage":"too many arguments","messagePattern":"too many arguments","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/spi/SnippetParameterInfo.java","lineNumber":60,"sourceCode":"import jdk.vm.ci.meta.JavaKind;\nimport jdk.vm.ci.meta.Local;\nimport jdk.vm.ci.meta.LocalVariableTable;\nimport jdk.vm.ci.meta.ResolvedJavaMethod;\nimport jdk.vm.ci.meta.ResolvedJavaType;\n\n/**\n * Encodes info about a snippet's parameters derived from annotations such as\n * {@link ConstantParameter}, {@link VarargsParameter} and {@link NonNullParameter} as well as class\n * file attributes such as {@link LocalVariableTable}. This supports libgraal where annotations and\n * class file attributes are not available.\n */\npublic final class SnippetParameterInfo {\n\n    public SnippetParameterInfo(ResolvedJavaMethod method) {\n        assert getAnnotationValue(method, Snippet.class) != null : method + \" must be annotated with @\" + Snippet.class.getSimpleName();\n        int parameterCount = method.getSignature().getParameterCount(method.hasReceiver());\n        if (parameterCount > Integer.SIZE) {\n            throw new UnsupportedOperationException(\"too many arguments\");\n        }\n        this.count = parameterCount;\n        int constant = 0;\n        int varargs = 0;\n        int nonNull = 0;\n        int offset = method.hasReceiver() ? 1 : 0;\n\n        var parsed = AnnotationValueSupport.getParameterAnnotationValues(method);\n        if (parsed != null) {\n            for (int i = offset; i < count; i++) {\n                List<AnnotationValue> annotations = parsed.values().get(i - offset);\n                int bit = 1 << i;\n                ResolvedJavaType container = parsed.container();\n                if (findAnnotationValue(annotations, ConstantParameter.class, container) != null) {\n                    constant |= bit;\n                }\n                if (findAnnotationValue(annotations, VarargsParameter.class, container) != null) {\n                    varargs |= bit;","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/spi/SnippetParameterInfo.java#L42-L78","documentation":"SnippetParameterInfo encodes per-parameter snippet annotations (@ConstantParameter, @VarargsParameter, @NonNullParameter) as bits in a single int, so a @Snippet method may have at most Integer.SIZE (32) parameters (SnippetParameterInfo.java:60). Thrown when a snippet method's parameter count exceeds this bit-packing limit.","triggerScenarios":"Defining or loading a @Snippet-annotated method whose signature (including receiver) has more than 32 parameters; the check runs when SnippetParameterInfo is constructed from the ResolvedJavaMethod.","commonSituations":"Gradually adding parameters to a long-lived snippet until it crosses 32; generated snippet code that emits signatures based on template parameters.","solutions":["Refactor the snippet to take fewer parameters: group related values into a small object or frame/stack manipulation instead of individual parameters","Move logic that needs many inputs out of the snippet and into a non-snippet helper called around it","If you cannot change the snippet, split it into two snippets invoked from separate locations"],"exampleFix":"// before\n@Snippet static void s(int a1, ..., int a33) { ... }\n\n// after\nrecord SArgs(int a1, ..., int a16) {}\n@Snippet static void s(SArgs args, int b1, ..., int b16) { ... }","handlingStrategy":"validation","validationCode":"assert method.getParameterCount() <= Integer.SIZE : \"snippet exceeds 32 parameters: \" + method;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep snippets under ~30 parameters by design; group values into parameter objects","When adding parameters to an existing snippet, check the current count first"],"tags":["graal","snippet","limits","annotations"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}