pinpoint-apm/pinpoint · error · NotFoundInstrumentException

Cannot find constructor with parameter types: ${constructorP

Error message

Cannot find constructor with parameter types: ${constructorParamTypes}

What it means

When an interceptor uses @TargetConstructor, addInterceptor0 looks up a constructor in the target class matching the declared parameter types via getConstructor(). If no constructor matches, a NotFoundInstrumentException is thrown listing the requested parameter types. The transform cannot proceed because there is nothing to attach the interceptor to.

Source

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

        }

        final TargetFilter targetFilter = interceptorClass.getAnnotation(TargetFilter.class);
        if (targetFilter != null) {
            interceptorId = addInterceptor0(targetFilter, interceptorClass, scope, executionPolicy, constructorArgs);
        }

        if (interceptorId == -1) {
            throw new PinpointException("No target is specified. At least one of @Targets, @TargetMethod, @TargetConstructor, @TargetFilter must present. interceptor: " + interceptorClass.getName());
        }

        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");

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Update the @TargetConstructor paramTypes to match the actual constructor of the target library version
  2. Verify the signature with javap -p on the target class
  3. Use @TargetFilter or method targeting instead if the constructor is unstable across versions

Example fix

// before
@TargetConstructor({"java.lang.String", "java.lang.Integer"})
// after
@TargetConstructor({"java.lang.String", "int"})
Defensive patterns

Strategy: validation

Validate before calling

for (Constructor<?> c : targetClass.getDeclaredConstructors()) {
    // compare c.getParameterTypes() with @TargetConstructor value before registering
}

Try / catch

try {
    clazz.addInterceptor(interceptorClass);
} catch (NotFoundInstrumentException e) {
    logger.warn("constructor signature changed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: addInterceptor with @TargetConstructor whose value() describes a constructor signature that does not exist in the target class; getConstructor(c.value()) returns null.

Common situations: Library version change altered the constructor signature; wrong paramTypes strings (class names not matching the loaded class); targeting a class that only has a default constructor while specifying parameters.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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