{"record":{"id":"319048b3fa54233d","repo":"pinpoint-apm/pinpoint","slug":"failed-to-add-setter-setterclassname","errorCode":null,"errorMessage":"Failed to add setter: ${setterClassName}","messagePattern":"Failed to add setter: (.+?)","errorType":"exception","errorClass":"InstrumentException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMClass.java","lineNumber":373,"sourceCode":"            }\n\n            try {\n                boolean modified = finalRemoved;\n                modified |= this.classNode.addSetterMethod(setterDetails.getSetter().getName(), fieldNode);\n                modified |= this.classNode.addInterface(setterClass.getName());\n                if (modified) {\n                    setModified(true);\n                } else if (logger.isDebugEnabled()) {\n                    logger.debug(\"Skip addSetter, setter already declared. class={}, setter={}\", getName(), setterClass.getName());\n                }\n            } catch (Exception e) {\n                if (finalRemoved) {\n                    fieldNode.setAccess(original);\n                }\n                throw e;\n            }\n        } catch (Exception e) {\n            throw new InstrumentException(\"Failed to add setter: \" + setterClass.getName(), e);\n        }\n    }\n\n    private Class<? extends Interceptor> loadInterceptorClass(String interceptorClassName) throws InstrumentException {\n        try {\n            final ClassLoader classLoader = classNode.getClassLoader();\n            return this.pluginContext.injectClass(classLoader, interceptorClassName);\n        } catch (Exception ex) {\n            throw new InstrumentException(interceptorClassName + \" not found Caused by:\" + ex.getMessage(), ex);\n        }\n    }\n\n\n    private int addInterceptor0(Class<? extends Interceptor> interceptorClass, Object[] constructorArgs, InterceptorScope scope, ExecutionPolicy executionPolicy) throws InstrumentException {\n        int interceptorId = -1;\n\n        final TargetMethods targetMethods = interceptorClass.getAnnotation(TargetMethods.class);\n        if (targetMethods != null) {","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMClass.java#L355-L391","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate setter class before use: it must expose a setter method matching the field name and type\nassert HasMatchingSetter(setterClass, targetClass, fieldName);","typeGuard":null,"tryCatchPattern":"try {\n    clazz.addSetter(setterClass, fieldName);\n} catch (InstrumentException e) {\n    logger.warn(\"addSetter failed for {}\", setterClass.getName(), e.getCause());\n}","preventionTips":["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"],"tags":["java","bytecode-instrumentation","wrapped-exception"],"backgroundTag":"invalid-argument-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}