pinpoint-apm/pinpoint · error · NotFoundInstrumentException

Cannot find method ${methodName} with parameter types: ${met

Error message

Cannot find method ${methodName} with parameter types: ${methodParamTypes}

What it means

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.

Source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMClass.java:440

        return interceptorId;
    }

    private int addInterceptor0(TargetConstructor c, Class<? extends Interceptor> interceptorClass, InterceptorScope scope, ExecutionPolicy executionPolicy, Object... constructorArgs) throws InstrumentException {
        final InstrumentMethod constructor = getConstructor(c.value());

        if (constructor == null) {
            throw new NotFoundInstrumentException("Cannot find constructor with parameter types: " + Arrays.toString(c.value()));
        }
        // TODO casting fix
        return ((ASMMethod) constructor).addInterceptorInternal(interceptorClass, constructorArgs, scope, executionPolicy);
    }

    private int addInterceptor0(TargetMethod m, Class<? extends Interceptor> interceptorClass, Object[] constructorArgs, InterceptorScope scope, ExecutionPolicy executionPolicy) throws InstrumentException {
        InstrumentMethod method = getDeclaredMethod(m.name(), m.paramTypes());

        if (method == null) {
            throw new NotFoundInstrumentException("Cannot find method " + m.name() + " with parameter types: " + Arrays.toString(m.paramTypes()));
        }
        // TODO casting fix
        return ((ASMMethod) method).addInterceptorInternal(interceptorClass, constructorArgs, scope, executionPolicy);
    }

    private int addInterceptor0(TargetFilter annotation, Class<? extends Interceptor> interceptorClass, InterceptorScope scope, ExecutionPolicy executionPolicy, Object[] constructorArgs) throws InstrumentException {
        final String filterTypeName = annotation.type();
        Objects.requireNonNull(filterTypeName, "type of @TargetFilter");

        ObjectBinderFactory objectBinderFactory = engineComponent.getObjectBinderFactory();
        final InterceptorArgumentProvider interceptorArgumentProvider = objectBinderFactory.newInterceptorArgumentProvider();
        final AutoBindingObjectFactory filterFactory = objectBinderFactory.newAutoBindingObjectFactory(pluginContext, classNode.getClassLoader(), interceptorArgumentProvider);
        final ObjectFactory objectFactory = ObjectFactory.byConstructor(filterTypeName, (Object[]) annotation.constructorArguments());
        final MethodFilter filter = (MethodFilter) filterFactory.createInstance(objectFactory);

        boolean singleton = annotation.singleton();
        int interceptorId = -1;

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Correct @TargetMethod name and paramTypes to match the actual target class declaration
  2. Check for inherited methods and target the declaring class instead
  3. Verify the signature with javap on the exact library version being instrumented
  4. Use @TargetFilter for version-tolerant matching

Example fix

// before
@TargetMethod(name = "execute", paramTypes = {"java.lang.String"})
// after
@TargetMethod(name = "execute", paramTypes = {"java.lang.String", "int"})
Defensive patterns

Strategy: validation

Validate before calling

boolean hasMethod = false;
for (Method m : targetClass.getDeclaredMethods()) {
    if (m.getName().equals(name) && Arrays.equals(paramTypes, typeNames(m.getParameterTypes()))) { hasMethod = true; }
}

Try / catch

try {
    clazz.addInterceptor(interceptorClass);
} catch (NotFoundInstrumentException e) {
    logger.warn("method not found in target: {}", e.getMessage());
}

Prevention

When it happens

Trigger: addInterceptor/addScopedInterceptor with @TargetMethod whose name() or paramTypes() do not match any declared method of the target class; getDeclaredMethod returns null.

Common situations: 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.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/0c8390e7b4400b37. Report an issue: GitHub.