pinpoint-apm/pinpoint · error · InstrumentException

not found new method. ${classInternalName}.${methodName}

Error message

not found new method. ${classInternalName}.${methodName}

What it means

After copying a pointcut method into the source class, copyPointCutMethods() retrieves the newly copied method node to apply method-instruction remapping (renaming internal join point calls). If getDeclaredMethod returns null right after the copy, the copy silently failed — an internal invariant violation — so InstrumentException is thrown.

Source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMAspectWeaver.java:135

                throw new InstrumentException("Signature miss match. method=" + pointCutMethodNode.getName() + ", source=" + sourceMethodNode.getDesc() + ", advice=" + pointCutMethodNode.getDesc());
            }

            if (logger.isInfoEnabled()) {
                logger.info("weaving method={}{}", sourceMethodNode.getName(), sourceMethodNode.getDesc());
            }

            // rename.
            final String methodName = this.methodNameReplacer.replaceMethodName(sourceMethodNode.getName());
            sourceMethodNode.rename(methodName);
            // set private.
            sourceMethodNode.setAccess(sourceMethodNode.getAccess() & -6 | Opcodes.ACC_PRIVATE);
            // copy.
            classNode.copyMethod(pointCutMethodNode);

            // remap
            final ASMMethodNodeAdapter newMethodNode = classNode.getDeclaredMethod(pointCutMethodNode.getName(), pointCutMethodNode.getDesc());
            if (newMethodNode == null) {
                throw new InstrumentException("not found new method. " + classNode.getInternalName() + "." + pointCutMethodNode.getName());
            }
            remapBuilder.setName(methodName);
            ASMMethodInsnNodeRemapper remapper = remapBuilder.build();
            newMethodNode.remapMethodInsnNode(remapper);
        }
    }

    private static class MethodNodes {
        public final List<ASMMethodNodeAdapter> pointCuts = new ArrayList<>();
        public final List<ASMMethodNodeAdapter> jointPoints = new ArrayList<>();
        public final List<ASMMethodNodeAdapter> utils = new ArrayList<>();
    }
}

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Check for a pre-existing method with the same name+descriptor in the source class before copying
  2. Verify the ASM library version supports the target class file version
  3. Enable debug logging around copyMethod to see why the copy failed
  4. Report as a bug if copyMethod returns success but the node is absent

Example fix

// before
classNode.copyMethod(pointCutMethodNode);
final ASMMethodNodeAdapter newMethodNode = classNode.getDeclaredMethod(pointCutMethodNode.getName(), pointCutMethodNode.getDesc());
// after
if (classNode.getDeclaredMethod(pointCutMethodNode.getName(), pointCutMethodNode.getDesc()) != null) {
    throw new IllegalStateException("duplicate pointcut method: " + pointCutMethodNode.getName());
}
classNode.copyMethod(pointCutMethodNode);
final ASMMethodNodeAdapter newMethodNode = classNode.getDeclaredMethod(pointCutMethodNode.getName(), pointCutMethodNode.getDesc());
Defensive patterns

Strategy: try-catch

Validate before calling

if (sourceClassNode.getDeclaredMethod(pointCutMethodNode.getName(), pointCutMethodNode.getDesc()) != null) { throw new IllegalStateException("duplicate pointcut before copy"); }

Try / catch

try { weaver.weaving(src, adv); } catch (InstrumentException e) { if (e.getMessage().startsWith("not found new method.")) { logger.error("copyMethod silently failed — check duplicates and ASM version"); } }

Prevention

When it happens

Trigger: classNode.copyMethod(pointCutMethodNode) did not actually add the method (e.g. duplicate method name+desc conflict or ASM copy failure), leaving no new node to remap.

Common situations: Advice declares a pointcut method identical to one already present in the source class; exotic class file versions/features that the ASM copy path mishandles.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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