pinpoint-apm/pinpoint · error · InstrumentException
source and advice class node must not be null.
Error message
source and advice class node must not be null.
What it means
ASMAspectWeaver.weaving() validates its two required class node arguments before weaving an advice class into a source class. If either the source class node or the advice class node is null it throws InstrumentException, since weaving cannot proceed without both bytecode representations.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMAspectWeaver.java:49
*/
public class ASMAspectWeaver {
private static final MethodNameReplacer DEFAULT_METHOD_NAME_REPLACER = new DefaultMethodNameReplacer();
private final Logger logger = LogManager.getLogger(this.getClass());
private final MethodNameReplacer methodNameReplacer;
public ASMAspectWeaver() {
this(DEFAULT_METHOD_NAME_REPLACER);
}
public ASMAspectWeaver(final MethodNameReplacer methodNameReplacer) {
this.methodNameReplacer = methodNameReplacer;
}
public void weaving(final ASMClassNodeAdapter sourceClassNode, final ASMClassNodeAdapter adviceClassNode) throws InstrumentException {
if (sourceClassNode == null || adviceClassNode == null) {
throw new InstrumentException("source and advice class node must not be null.");
}
if (logger.isInfoEnabled()) {
logger.info("weaving sourceClass={} adviceClass={}", sourceClassNode.getInternalName(), adviceClassNode.getInternalName());
}
if (!adviceClassNode.hasAnnotation(Aspect.class)) {
throw new InstrumentException("@Aspect not found. adviceClass=" + adviceClassNode.getInternalName());
}
// advice class hierarchy check.
final boolean isSubclass = adviceClassNode.subclassOf(sourceClassNode.getInternalName());
if (!isSubclass) {
final String superClassInternalName = adviceClassNode.getSuperClassInternalName();
if (superClassInternalName == null || !superClassInternalName.equals("java/lang/Object")) {
throw new InstrumentException("invalid class hierarchy. source class=" + sourceClassNode.getInternalName() + ", advice class=" + adviceClassNode.getInternalName() + ", super class=" + superClassInternalName);
}
}View on GitHub (pinned to 744c3d3075)
Solutions
- Check both arguments for null before calling weaving()
- Verify the advice class exists on the agent/plugin classpath
- Confirm the source class was successfully parsed by ASMClassNodeAdapter before weaving
- Log the class name that failed to load to identify the missing bytecode
Example fix
// before
weaver.weaving(sourceNode, adviceNode);
// after
if (sourceNode == null || adviceNode == null) {
throw new IllegalStateException("cannot weave: source=" + sourceNode + " advice=" + adviceNode);
}
weaver.weaving(sourceNode, adviceNode); Defensive patterns
Strategy: validation
Validate before calling
if (sourceClassNode == null || adviceClassNode == null) { throw new IllegalArgumentException("both class nodes required"); } Type guard
boolean canWeave = sourceClassNode != null && adviceClassNode != null;
Try / catch
try { weaver.weaving(src, adv); } catch (InstrumentException e) { logger.error("weaving failed: {}", e.getMessage()); } Prevention
- Verify class loading succeeded before weaving
- Null-check adapter results
- Log which class failed to parse
When it happens
Trigger: Calling weaving(sourceClassNode, adviceClassNode) with a null argument — usually when a class adapter failed to load/parse the bytecode and returned null instead of throwing.
Common situations: Aspect weaving during agent bootstrap where the advice class could not be read from the classpath, or a plugin passes a null node after a failed ASM parse.
Related errors
- @Aspect not found. adviceClass=${adviceClassInternalName}
- invalid class hierarchy. source class=${sourceClassInternalN
- not found new method. ${classInternalName}.${methodName}
- unexpected {} invoke count {}
- No methods are intercepted. target:{}, interceptor:{}, metho
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/8cf9da24182c3d92.
Report an issue: GitHub.