{"record":{"id":"b020959038437309","repo":"pinpoint-apm/pinpoint","slug":"before-method-not-found-arrays-tostring-befo","errorCode":null,"errorMessage":"${before} method not found. ${Arrays.toString(beforeParamList)}","messagePattern":"(.+?) method not found\\. (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/interceptor/InterceptorDefinitionFactory.java","lineNumber":182,"sourceCode":"            this.after = Objects.requireNonNull(after, \"after\");\n            this.afterParamList = Objects.requireNonNull(afterParamList, \"afterParamList\");\n        }\n\n\n        public InterceptorDefinition resolveType(Class<?> targetClazz) {\n            if(!this.interceptorClazz.isAssignableFrom(targetClazz)) {\n                return null;\n            }\n            @SuppressWarnings(\"unchecked\")\n            final Class<? extends Interceptor> casting = (Class<? extends Interceptor>) targetClazz;\n            return createInterceptorDefinition(casting);\n        }\n\n        private InterceptorDefinition createInterceptorDefinition(Class<? extends Interceptor> targetInterceptorClazz) {\n\n            final Method beforeMethod = searchMethod(targetInterceptorClazz, before, beforeParamList);\n            if (beforeMethod == null) {\n                throw new RuntimeException(before + \" method not found. \" + Arrays.toString(beforeParamList));\n            }\n            final boolean beforeIgnoreMethod = beforeMethod.isAnnotationPresent(IgnoreMethod.class);\n            final boolean blockType = beforeMethod.getReturnType() == TraceBlock.class;\n            final Method afterMethod = searchMethod(targetInterceptorClazz, after, afterParamList);\n            if (afterMethod == null) {\n                throw new RuntimeException(after + \" method not found. \" + Arrays.toString(afterParamList));\n            }\n            final boolean afterIgnoreMethod = afterMethod.isAnnotationPresent(IgnoreMethod.class);\n\n            if (interceptorType == InterceptorType.RESULT_REPLACE && afterMethod.getReturnType() != Object.class) {\n                // a covariant override would change the weaved call descriptor and break the INVOKEINTERFACE site.\n                throw new RuntimeException(after + \" must return java.lang.Object. \" + targetInterceptorClazz.getName());\n            }\n\n            if (beforeIgnoreMethod && afterIgnoreMethod) {\n                return new DefaultInterceptorDefinition(interceptorClazz, targetInterceptorClazz, interceptorType, CaptureType.NON, null, null);\n            }\n            if (beforeIgnoreMethod) {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/interceptor/InterceptorDefinitionFactory.java#L164-L200","documentation":"RuntimeException thrown by the TypeHandler's createInterceptorDefinition when the before() method with the expected parameter list cannot be found on the interceptor class (the after() variant throws a symmetric message). The method name exists but its parameter types do not match what the interceptor type demands.","triggerScenarios":"searchMethod(targetInterceptorClazz, \"before\", beforeParamList) returns null because the declared before() signature differs from the candidate interceptor type's expected parameters (wrong number or types of arguments).","commonSituations":"Mixing interceptor type expectations - e.g. declaring before(Object, Object[]) while the detected type expects before(Object, int, Object, String, ...) per the API metadata, or copy-pasting an interceptor from an older Pinpoint version whose signature set changed.","solutions":["Match your before()/after() parameter lists to the exact expected signature of the interceptor type you intend to implement.","Copy the canonical signatures from a built-in Pinpoint interceptor of the same type.","Confirm the plugin targets the same Pinpoint interceptor API version used by the agent.","Check the logged Arrays.toString(beforeParamList) to see exactly which parameter list was searched for."],"exampleFix":"// before\npublic void before(Object target, Object[] args) { } // type expects full signature\n// after\npublic void before(Object target, int apiId, Object targetClass, String methodName, String parameterDescriptor, Object[] args) { }","handlingStrategy":"validation","validationCode":"// verify exact expected signature exists before registration\nMethod before = Arrays.stream(clazz.getDeclaredMethods())\n    .filter(m -> m.getName().equals(\"before\"))\n    .filter(m -> Arrays.equals(m.getParameterTypes(), expectedBeforeParams))\n    .findFirst().orElseThrow(() -> new IllegalArgumentException(clazz + \" before() signature mismatch: \" + Arrays.toString(expectedBeforeParams)));","typeGuard":null,"tryCatchPattern":"try { def = typeHandler.resolveType(clazz); } catch (RuntimeException e) { if (e.getMessage().contains(\"method not found.\")) { /* align parameter list with the logged expected params */ } throw e; }","preventionTips":["Match before/after parameter lists exactly to the chosen interceptor type","Copy signatures from a same-version built-in interceptor","Re-check signatures after any Pinpoint version upgrade"],"tags":["interceptor","signature-mismatch","pinpoint","reflection"],"backgroundTag":"method-signature-mismatch","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}