{"record":{"id":"0c8390e7b4400b37","repo":"pinpoint-apm/pinpoint","slug":"cannot-find-method-methodname-with-parameter-ty","errorCode":null,"errorMessage":"Cannot find method ${methodName} with parameter types: ${methodParamTypes}","messagePattern":"Cannot find method (.+?) with parameter types: (.+?)","errorType":"exception","errorClass":"NotFoundInstrumentException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMClass.java","lineNumber":440,"sourceCode":"\n        return interceptorId;\n    }\n\n    private int addInterceptor0(TargetConstructor c, Class<? extends Interceptor> interceptorClass, InterceptorScope scope, ExecutionPolicy executionPolicy, Object... constructorArgs) throws InstrumentException {\n        final InstrumentMethod constructor = getConstructor(c.value());\n\n        if (constructor == null) {\n            throw new NotFoundInstrumentException(\"Cannot find constructor with parameter types: \" + Arrays.toString(c.value()));\n        }\n        // TODO casting fix\n        return ((ASMMethod) constructor).addInterceptorInternal(interceptorClass, constructorArgs, scope, executionPolicy);\n    }\n\n    private int addInterceptor0(TargetMethod m, Class<? extends Interceptor> interceptorClass, Object[] constructorArgs, InterceptorScope scope, ExecutionPolicy executionPolicy) throws InstrumentException {\n        InstrumentMethod method = getDeclaredMethod(m.name(), m.paramTypes());\n\n        if (method == null) {\n            throw new NotFoundInstrumentException(\"Cannot find method \" + m.name() + \" with parameter types: \" + Arrays.toString(m.paramTypes()));\n        }\n        // TODO casting fix\n        return ((ASMMethod) method).addInterceptorInternal(interceptorClass, constructorArgs, scope, executionPolicy);\n    }\n\n    private int addInterceptor0(TargetFilter annotation, Class<? extends Interceptor> interceptorClass, InterceptorScope scope, ExecutionPolicy executionPolicy, Object[] constructorArgs) throws InstrumentException {\n        final String filterTypeName = annotation.type();\n        Objects.requireNonNull(filterTypeName, \"type of @TargetFilter\");\n\n        ObjectBinderFactory objectBinderFactory = engineComponent.getObjectBinderFactory();\n        final InterceptorArgumentProvider interceptorArgumentProvider = objectBinderFactory.newInterceptorArgumentProvider();\n        final AutoBindingObjectFactory filterFactory = objectBinderFactory.newAutoBindingObjectFactory(pluginContext, classNode.getClassLoader(), interceptorArgumentProvider);\n        final ObjectFactory objectFactory = ObjectFactory.byConstructor(filterTypeName, (Object[]) annotation.constructorArguments());\n        final MethodFilter filter = (MethodFilter) filterFactory.createInstance(objectFactory);\n\n        boolean singleton = annotation.singleton();\n        int interceptorId = -1;\n","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMClass.java#L422-L458","documentation":"When an interceptor uses @TargetMethod, addInterceptor0 resolves the method by name and parameter types via getDeclaredMethod(). If no declared method matches, a NotFoundInstrumentException is thrown with the method name and expected parameter types. This happens before any interceptor weaving occurs.","triggerScenarios":"addInterceptor/addScopedInterceptor with @TargetMethod whose name() or paramTypes() do not match any declared method of the target class; getDeclaredMethod returns null.","commonSituations":"Target library upgraded and method renamed/moved; paramTypes given as java.lang.String style but method uses primitives or vice versa; method is inherited (getDeclaredMethod only sees declared methods); typo in method name.","solutions":["Correct @TargetMethod name and paramTypes to match the actual target class declaration","Check for inherited methods and target the declaring class instead","Verify the signature with javap on the exact library version being instrumented","Use @TargetFilter for version-tolerant matching"],"exampleFix":"// before\n@TargetMethod(name = \"execute\", paramTypes = {\"java.lang.String\"})\n// after\n@TargetMethod(name = \"execute\", paramTypes = {\"java.lang.String\", \"int\"})","handlingStrategy":"validation","validationCode":"boolean hasMethod = false;\nfor (Method m : targetClass.getDeclaredMethods()) {\n    if (m.getName().equals(name) && Arrays.equals(paramTypes, typeNames(m.getParameterTypes()))) { hasMethod = true; }\n}","typeGuard":null,"tryCatchPattern":"try {\n    clazz.addInterceptor(interceptorClass);\n} catch (NotFoundInstrumentException e) {\n    logger.warn(\"method not found in target: {}\", e.getMessage());\n}","preventionTips":["Match paramTypes against the exact target class, not superclasses","Run plugin integration tests against every supported library version","Use @TargetFilter when signatures vary across versions"],"tags":["java","pinpoint-plugin","method-resolution"],"backgroundTag":"method-not-found","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"}