pinpoint-apm/pinpoint · error · InstrumentException
Failed to add setter: ${setterClassName}
Error message
Failed to add setter: ${setterClassName} What it means
addSetter wraps any exception raised while weaving the setter (field lookup, access modification, bytecode generation) into an InstrumentException with the setter class name. The original exception is attached as the cause, so the real failure reason (e.g. the field not found or a static/final rejection) must be read from the cause chain.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMClass.java:373
}
try {
boolean modified = finalRemoved;
modified |= this.classNode.addSetterMethod(setterDetails.getSetter().getName(), fieldNode);
modified |= this.classNode.addInterface(setterClass.getName());
if (modified) {
setModified(true);
} else if (logger.isDebugEnabled()) {
logger.debug("Skip addSetter, setter already declared. class={}, setter={}", getName(), setterClass.getName());
}
} catch (Exception e) {
if (finalRemoved) {
fieldNode.setAccess(original);
}
throw e;
}
} catch (Exception e) {
throw new InstrumentException("Failed to add setter: " + setterClass.getName(), e);
}
}
private Class<? extends Interceptor> loadInterceptorClass(String interceptorClassName) throws InstrumentException {
try {
final ClassLoader classLoader = classNode.getClassLoader();
return this.pluginContext.injectClass(classLoader, interceptorClassName);
} catch (Exception ex) {
throw new InstrumentException(interceptorClassName + " not found Caused by:" + ex.getMessage(), ex);
}
}
private int addInterceptor0(Class<? extends Interceptor> interceptorClass, Object[] constructorArgs, InterceptorScope scope, ExecutionPolicy executionPolicy) throws InstrumentException {
int interceptorId = -1;
final TargetMethods targetMethods = interceptorClass.getAnnotation(TargetMethods.class);
if (targetMethods != null) {View on GitHub (pinned to 744c3d3075)
Solutions
- Inspect the cause chain of the InstrumentException for the root exception
- Verify the setter class follows the required setter contract (single setter method matching field name and type)
- Check ASM library version compatibility bundled with the agent
- Enable profiler debug logging to see the weaving step that failed
Defensive patterns
Strategy: try-catch
Validate before calling
// Validate setter class before use: it must expose a setter method matching the field name and type assert HasMatchingSetter(setterClass, targetClass, fieldName);
Try / catch
try {
clazz.addSetter(setterClass, fieldName);
} catch (InstrumentException e) {
logger.warn("addSetter failed for {}", setterClass.getName(), e.getCause());
} Prevention
- Always log the cause chain, not just the wrapper message
- Keep setter classes simple and conforming to the setter contract
- Pin ASM version used by the agent to avoid bytecode generation failures
When it happens
Trigger: Any Exception thrown during ASMClass.addSetter() after validation, e.g. bytecode generation failures inside the try block; note the static/final validation errors (170/171) rethrow as-is, but other weave failures are wrapped by this catch.
Common situations: Malformed setter class (wrong signature, no matching field type); ASM API version conflicts on the agent classpath; unexpected class file version of the target class.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Cannot add setter to static fields. setterMethod: ${setterNa
- Cannot add setter to final field. setterMethod: ${setterName
- Failed to load plugin class ${className} with classLoader ${
- %s load fail Caused by:%s
- J9BootLoader create fail Caused by:
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/319048b3fa54233d.
Report an issue: GitHub.