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

  1. Inspect the cause chain of the InstrumentException for the root exception
  2. Verify the setter class follows the required setter contract (single setter method matching field name and type)
  3. Check ASM library version compatibility bundled with the agent
  4. 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

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


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