pinpoint-apm/pinpoint · error · PinpointException

No target is specified. At least one of @Targets, @TargetMet

Error message

No target is specified. At least one of @Targets, @TargetMethod, @TargetConstructor, @TargetFilter must present. interceptor: ${interceptorClassName}

What it means

addInterceptor0 requires the interceptor class to declare at least one targeting annotation: @Targets, @TargetMethod, @TargetConstructor, or @TargetFilter. If none of these annotations are present, the interceptor id stays -1 and a PinpointException is thrown. This is a plugin metadata validation, not a runtime weaving failure.

Source

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

        final TargetConstructors targetConstructors = interceptorClass.getAnnotation(TargetConstructors.class);
        if (targetConstructors != null) {
            for (TargetConstructor c : targetConstructors.value()) {
                interceptorId = addInterceptor0(c, interceptorClass, scope, executionPolicy, constructorArgs);
            }
        }

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

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

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Annotate the interceptor class with @TargetMethod, @TargetConstructor, @TargetFilter or @Targets
  2. If registering programmatically, use the API overloads that accept explicit method/constructor targets
  3. Review the plugin's interceptor classes for missing annotations after refactoring

Example fix

// before
public class MyInterceptor implements AroundInterceptor { ... }
// after
@TargetMethod(name = "doGet", paramTypes = {"javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse"})
public class MyInterceptor implements AroundInterceptor { ... }
Defensive patterns

Strategy: validation

Validate before calling

if (!(ic.getClass().isAnnotationPresent(Targets.class) || ic.getClass().isAnnotationPresent(TargetMethod.class) || ic.getClass().isAnnotationPresent(TargetConstructor.class) || ic.getClass().isAnnotationPresent(TargetFilter.class))) {
    throw new IllegalStateException(ic.getName() + " lacks a target annotation");
}

Prevention

When it happens

Trigger: Calling addInterceptor/addScopedInterceptor with an interceptor Class that has none of @Targets/@TargetMethod/@TargetConstructor/@TargetFilter annotations.

Common situations: Plugin authors forget to annotate the interceptor; annotations placed on the wrong class; refactor renames that dropped annotations; hand-built interceptor registration without base annotations.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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