pinpoint-apm/pinpoint · error · RuntimeException
${before} method not found. ${Arrays.toString(beforeParamLis
Error message
${before} method not found. ${Arrays.toString(beforeParamList)} What it means
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.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/interceptor/InterceptorDefinitionFactory.java:182
this.after = Objects.requireNonNull(after, "after");
this.afterParamList = Objects.requireNonNull(afterParamList, "afterParamList");
}
public InterceptorDefinition resolveType(Class<?> targetClazz) {
if(!this.interceptorClazz.isAssignableFrom(targetClazz)) {
return null;
}
@SuppressWarnings("unchecked")
final Class<? extends Interceptor> casting = (Class<? extends Interceptor>) targetClazz;
return createInterceptorDefinition(casting);
}
private InterceptorDefinition createInterceptorDefinition(Class<? extends Interceptor> targetInterceptorClazz) {
final Method beforeMethod = searchMethod(targetInterceptorClazz, before, beforeParamList);
if (beforeMethod == null) {
throw new RuntimeException(before + " method not found. " + Arrays.toString(beforeParamList));
}
final boolean beforeIgnoreMethod = beforeMethod.isAnnotationPresent(IgnoreMethod.class);
final boolean blockType = beforeMethod.getReturnType() == TraceBlock.class;
final Method afterMethod = searchMethod(targetInterceptorClazz, after, afterParamList);
if (afterMethod == null) {
throw new RuntimeException(after + " method not found. " + Arrays.toString(afterParamList));
}
final boolean afterIgnoreMethod = afterMethod.isAnnotationPresent(IgnoreMethod.class);
if (interceptorType == InterceptorType.RESULT_REPLACE && afterMethod.getReturnType() != Object.class) {
// a covariant override would change the weaved call descriptor and break the INVOKEINTERFACE site.
throw new RuntimeException(after + " must return java.lang.Object. " + targetInterceptorClazz.getName());
}
if (beforeIgnoreMethod && afterIgnoreMethod) {
return new DefaultInterceptorDefinition(interceptorClazz, targetInterceptorClazz, interceptorType, CaptureType.NON, null, null);
}
if (beforeIgnoreMethod) {View on GitHub (pinned to 744c3d3075)
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.
Example fix
// before
public void before(Object target, Object[] args) { } // type expects full signature
// after
public void before(Object target, int apiId, Object targetClass, String methodName, String parameterDescriptor, Object[] args) { } Defensive patterns
Strategy: validation
Validate before calling
// verify exact expected signature exists before registration
Method before = Arrays.stream(clazz.getDeclaredMethods())
.filter(m -> m.getName().equals("before"))
.filter(m -> Arrays.equals(m.getParameterTypes(), expectedBeforeParams))
.findFirst().orElseThrow(() -> new IllegalArgumentException(clazz + " before() signature mismatch: " + Arrays.toString(expectedBeforeParams))); Try / catch
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; } Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- ${methodName} not found
- duplicated method exist. methodName:${methodName}
- ${moduleFactoryClazzName} ModuleFactory initialize fail
- invocation fail, className=
- not found 'get' method, className=
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/b020959038437309.
Report an issue: GitHub.